Solved

Adding date to filename in a shell script

Posted on 2004-04-25
2
3,218 Views
Last Modified: 2013-12-16
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
Comment
Question by:kingpin200004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 10911444
Theres a Perl Script here that includes the funtionality you are after?
http://www.imagefolio.com/resources/mods/backup/index.txt
Pete
0
 
LVL 1

Accepted Solution

by:
joesp earned 125 total points
ID: 10912602
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
capture pcap with filtered traffic 1 98
bash file 10 69
Intel fortran compiler (ifort) 5 62
Advice on ESXi 5.1 Health / Storage 1 49
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question