Written by Guillermo Garron .
Date: 2013-01-31 00:11:13 +0000
If you need to create a file where the file-name or at least part of it is the current system name you can use this format.
touch file-`date +%F_%T`.txt
This is useful if you are creating reports daily, and you do not want to override them. Suppose you are backing up your MySQL database.
mysqldump -u user --opt some_database > /tmp/some_database-`date +%F_%T`.sql
If you make a cron job to backup your database every day at 23.59 you will have after some days.
comments powered by Disqus