Look at "man date", which will show you how to cutomize the output of date to get 
something of the right form.
Then use something like:

mydate=`date +%b%d`
filename="backup_"${mydate}".tgz"

Note: the single quotes around the date command are those you get by pressing the 
button to the left of '1' (at
least on my keyboard).

Hope that helps,
Nick


Thierry De Corte wrote:

> I want to backup some files using tar in a script... How can I use the current date 
>to create the file name?
>
> In other words, I want to script the command:
>
> #!/bin/sh
> tar -zcvf backup_jun18.tgz /some_dir/*
>
> with the date part automatic (the date can be any formats)...
>
> Thanks


Reply via email to