[NTLUG:Discuss] Using current date in a script
Alton R. Pouncey, II
alton at trainers-r-us.com
Wed Feb 5 23:21:48 CST 2003
On Wed, 2003-02-05 at 23:07, Minh Duong wrote:
> Does anybody know how to use the current date when
> writing a shell script? What I am trying to do is
> capture some information and save it as a file with
> the filename as the date. For example:
>
> cat file >> 20030205.txt
>
> The problem is I don't know how I can pass the date in
> that form as text without resorting to using something
> like java.
>
> Minh
>
Try this:
filename=`date '+%Y%m%d'`
cat file >> "$filename".txt
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
--
Alton Pouncey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
Url : http://ntlug.org/pipermail/discuss/attachments/20030205/dc68cd9f/attachment.bin
More information about the Discuss
mailing list