[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Pls help with little bash script



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]