newbie shell script question

Michal Ludvig michal at logix.cz
Tue Jun 27 02:15:51 UTC 2006


Ken N9VV wrote:
> Hi, in a shell script, how do you create a filename with today's date
> appended at the end of the filename?

Assuming BASH...

NAME="/path/to/file-$(date +%Y-%m-%d)"

Then use $NAME as the filename.

See "man date" and "man bash" for  details.

Michal * http://www.logix.cz/michal










More information about the ubuntu-users mailing list