osx - OS X terminal command to create a file named on current date -


I have set up a cron job and I want to save the output to a file. The filename should be based on the time the cron was executed (example: 20110317-113051.txt).

My real cron command is as follows:

 lynx-dd> /Volumes/dev0/textfile.txt  

I want to replace textfile by a unique time stamp.

I have tried

 links - dump> $ (Date) .txt  but I get an error that the command is unclear 

Thank you for your help!

Sorin

date $ (date +% Y % M% d-% H% M% S) .txt can be given a format for determining how to create this date, / code>. With this format, the output of date should be free from spaces, brackets, etc., which can confuse shell or links command.

Look for documentation of document and format string for date , which is similar to the strftime function in the standard library.

Comments