• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3238
  • Last Modified:

Adding date to filename in a shell script

hi I have tar -cf /home/1.tar *.* in a script to do a Daly backup with I need is to change 1.tar to the date i.e. 1-2-04.tar etc i am guessing the clock or date commands would need to be used thanks
0
kingpin200004
Asked:
kingpin200004
1 Solution
 
Pete LongTechnical ConsultantCommented:
Theres a Perl Script here that includes the funtionality you are after?
http://www.imagefolio.com/resources/mods/backup/index.txt
Pete
0
 
joespCommented:
Here's my little mysql backup script.  
#!/bin/sh
present=`date +%b%d%y`
mysqldump -uUSERNAME -pPASSWORD --databases THIS_ONE_DB > $present.sql

which produces files like
~
Feb1604.sql

god bless
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now