Appending current date and time to a file
Hi,
I want to append the current date and time to a file from a script. How is this magic done. Checked for environment variables like $TIME or $DATE but no luck. Thanks in advance |
simple
echo `date`>>filename_to_append_to won't work? you might as well peruse man date for detailed format of the date that you can manipulate |
Should have made it clear.
I want to append to the filename not the file itself. Looked at the man page though. the idea is I have compiled files that I want named by time. |
Try
# cat arq > "arq-`date`" there's also a lot of format's this date exit could assume, to see then check his options (%): # man date |
# cat arq > "arq-`date`" doesn't work, cats my 5 meg file!!!
tried mv filename.sh "filename-'date'.sh" just renames it to filename-date.sh. Thanks though |
Hers's a little alias which I use in the bash shell:
Code:
alias otag="date +-%Y-%m%d-%H%Mh%S" Code:
$ script file`otag` |
All times are GMT -5. The time now is 11:01 AM. |