On Thursday 23 Jan 2003 4:19 pm, Robert P. J. Day wrote:
> On Thu, 23 Jan 2003, Jan wrote:
> > Jianping Zhu wrote:
> > > I have redhat 7.3, i want to use currnt date as file extension by using
> > > following command.
> > > mv myfile myfile.${`date`}
> > > but it does not work.
> > > how to do that?
> > > Thanks
> >
> > Like this:
> >
> > mv myfile "myfile.$(date)"
> >
> > - $() with round brackets is the one to use. However, that leaves you
> > with a filename with embedded spaces!
>
> more to the point, you should decide exactly what format you want
> that date extension in, and "man date" to see the options through
> which you can generate that format.
>
> eg  $(date +%d%m%y)

You'll probably find that 

date +%Y%m%d would be better as it puts the date in CCYYMMDD format which 
means that the files would appear in the correct sequence in 'ls' etc.

%H%M%s add hours minutes and seconds in case you need that much accuracy.

Gary
>
> that sort of thing.
>
> rday

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



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

Reply via email to