Pls help with little bash script

Michael J. Pawlowsky mikep at mi-consultants.com
Tue Sep 13 07:10:10 UTC 2005


Fajar Priyanto wrote:

>Hi all,
>I want to automate backup process into crontab.
>What I usually manually do is:
>tar zcvf filename-date.tar.gz /somedirectory
>
>Can anyone help me with the script needed that can include the date in the 
>filename?
>Thanks.
>  
>

Well just assign date to something and then use it.
Like:

OLDFILE = 'myfile.gz'
TODAY = `date +%F`
NEWFILE = $TODAY-$OLDFILE

mv $OLDFILE $NEWFILE


Cheers,
Mike




More information about the users mailing list