View Single Post
  #17   Report Post  
Posted to rec.crafts.metalworking
James Waldby[_3_] James Waldby[_3_] is offline
external usenet poster
 
Posts: 257
Default Where were you 10 years ago today

On Mon, 12 Sep 2011 03:44:27 +0000, DoN. Nichols wrote:
[snip re m/d/y vs d/m/y]

And for generating filenames, I've got a script which I've
called "ddate" which produces output of the format:

.2011-09-11

and I usually use it as follows:

mv filename filename`ddate`

so "filename" becomes "filename.2011-09-11" (or whatever is the current
date).


My preference is to append the file's modification date, formatted with
dot rather than dash separators, so my script called append-file-date
uses an expression like following,
$(date -r $F +%Y.%m.%d)
where $F contains filename, to create a suffix.

(In case you do not know unix, two things should be explained
about the above:

[snip 1) ]

2) Enclosing a command (e.g. "ddate") in backquotes "`", accent
grave replaces its location in the command line with the output from
running that command.


Backticks work ok for that purpose in several shells, but the posix
form $(...) works in more of them. %() also can be easily nested; eg,
echo $(echo $(date))
prints current date and time in posix shells. In new scripts I only
use the $(...) form, but still use `...` at prompt since it's easy
to type.

--
jiw