[KLUG Members] script getting date variable

Bruce Smith members@kalamazoolinux.org
21 Aug 2002 14:12:24 -0400


> 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?

Piece of cake:

  date +%d%m%Y

See the man page for date, you can format the output almost any way.

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------