WonderG914
09-29-2003, 11:28 AM
I need to write a small script to tar some files. I have never written one line of code in a linux environment. Where do I start? Is there a book or a place on the web where I can go to learn the basics?
|
Click to See Complete Forum and Search --> : Scripting for backups WonderG914 09-29-2003, 11:28 AM I need to write a small script to tar some files. I have never written one line of code in a linux environment. Where do I start? Is there a book or a place on the web where I can go to learn the basics? Hayl 09-29-2003, 11:42 AM http://www.justlinux.com/nhf/Programming WonderG914 09-29-2003, 11:57 AM I assume I should use bash shell scripting. Thanks for the help. I thought I had looked throught the library. WonderG914 09-30-2003, 08:15 AM Please tell me what I'm doing wrong. #!/bin/bash #Set variables for time date stamp VAR_MONTH=`date +%m` VAR_DAY=`date +%d` VAR_YEAR=`date +%y` VAR_HOUR=`date +%H` VAR_MIN=`date +%M` #test output echo "daily_backup-$VAR_MONTH-$VAR_DAY-$VAR_YEAR.tar.gz" #Make a backup #tar -cvzf /backups/daily_backup_$VAR_MONTH-$VAR_DAY-$VAR_YEAR.tar.gz /mnt/samba/folder I want the output to look like: daily_backup-9-30-03.tar.gz But it ends up looking like this: -03ly_backup-09 goon12 09-30-2003, 08:41 AM I just cut and pastes, and ran your script... [me@domain a_folder]$ sh foo.sh daily_backup-09-30-03.tar.gz [me@domain a_folder]$ Seems to work ok from here.. -goon12 superted 09-30-2003, 09:08 AM worked here also WonderG914 09-30-2003, 09:11 AM Thanks foir helping, but I still cannot to get it to print correctly. justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |