Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a cron job for creating a gzip file:

mysqldump... | gzip -c > myfile..sql.gz

I want myfile to be of the format "time_date.sql.gz"

How do I create file with the current date and time?

Thanks

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted
myfile_`date '+%F_%T'`.sql.gz
share|improve this answer
    
thanks......... –  Am. Feb 8 '10 at 16:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.