On Friday 04 October 2002 08:12 am, kristoff is done writ:

> A want to create a file "10_Oct_2002.out"  ( based on todays date )
> How can I do this using the date command , pipes , redirections & touch 
> command.

> I've tried things like : # touch < date +%m_%b_%y.out 
                                # several other combinations 

> But I don't seem to find the magic combination

The date command can be a bit tricky, until you get the hang of it. The 
command you want is
        touch `date +"%d_%b_%Y.out"`

First, note that the date command is inside backticks (same key as the ~). 
This says to evaluate the command, and use its output in the outer command.

Next, note that the format parameters are *inside* quotation marks ("double 
quotes", *NOT* single). The formatting parms will be interpreted by the 
command, this way, and the underscores and the .out will be treated as 
literals. I have found, over the years, that even without literals, I *have* 
to put the formatting parms inside quotes after the plus sign (and *NO* 
spaces between the + and the ".

        mark
-- 
"Get money. Get it quickly. Get it in abundance. Get it dishonestly,
if you can, honestly, if you must." - the Gospel as preached by
the robber barons, according to Mark Twain (does this sound familiar?)



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to