21.14 Automatically Appending the Date to a FilenameI suppose this falls into the category of "stupid tricks" but I still find it useful sometimes. I created a simple alias called vid , which I use to create and edit a file with a date as part of the filename. I find it handy for repetitive reports and memos. The alias looks like this:
alias vid "vi \!:1.`date +%m.%d`" and given an argument like memo or status , appends the date as an extension. Using wildcards, I can then list all my memos of a particular date or a particular subject:
%
If I wanted to add the year, I'd put a dot or other separator,
followed by If you understand backquote interpolation ( 9.16 ) and the formats for the date ( 51.10 ) command, you can easily develop variations of this alias that work with other commands besides vi . - |
|