[KLUG Members] script getting date variable

Jason S. Hackney members@kalamazoolinux.org
Wed, 21 Aug 2002 19:54:08 -0400


On Wednesday 21 August 2002 2:02 pm, you wrote:

Bill,

I have a script I use for backing up my system and needed a way to get a 
unique date everytime AND use that date as a filename, so this is just one 
way that I've done it:

FILENAME=$(date +%s)
... some bash code ...
tar rpPf /backup/${FILENAME}\.tar

And that's the idea. Hope that's somewhat useful. BTW, that date will return 
in UNIX time, which, as far as I know, is always unique.

> I want to have a shell script create a file whose name includes the date.
>
> The script currently does everything but get the date.  I could grab the
> output of the date command, but that looks wonky.  How can I get a DDMMYYYY
> or something similar?
>
> kind regards,
>
> bill hollett
>
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>