Results 1 to 3 of 3
Im pretty new to linux and shell scripting and im trying to learn it
Im trying to make a script that makes a backup of my home folder into /tmp/backup ...
- 12-06-2011 #1Just Joined!
- Join Date
- Dec 2011
- Posts
- 5
little help with my backup script please
Im pretty new to linux and shell scripting and im trying to learn it
Im trying to make a script that makes a backup of my home folder into /tmp/backup (this part i can do)
but also if the dir /tmp/back does not excist i want the script to create it
this is what i have so far but i cant reall get it to work
Code:BRONDIR=/home/draxor BESTEMMINGDIR=/home/tmp/backup FILENAAM=Backup-$(date +%-y%-m%-d)-$(date +%-T).bac tar --create --gzip --file=$BESTEMMINGDIR$FILENAAM $BRONDIR PATH=$/home/draxor/backup If [ -d $PATH]; Then Cp backup.bac /home/draxor Else Mkdir $PATH Echo "backup folder wordt aangemaakt & bestanden worden gekopieerd" Cp backup.bac /home/draxor/ Fi
- 12-06-2011 #2
I try like this.
The '!' (or bang as its called) means 'not'.Code:dir = /path/to/folder if [ ! -d $dir ]; then mkdir $dir # or whatever routine you want to call# fi
And no "$" in the name of your path variable.linux user # 503963
- 12-06-2011 #3Just Joined!
- Join Date
- Dec 2011
- Posts
- 5
thanks ill give it a try


Reply With Quote