Here is the script to take input from user and to do backup as they wish.
#!/bin/bash
dialog --inputbox " Please Enter the location where back will be stored" 9 50 2>/tmp/i1
a0=`cat /tmp/i1`
test ! -d $a0 && dialog --msgbox " $a0 dont exit .. we will make for u " 9 50 && mkdir $a0 && dialog --msgbox "ok $a0 made " 9 50 || dialog --msgbox " Destination $a0 exist/or its cant be made ... we will go forward " 9 50
dialog --inputbox " Please Enter the location to back-up" 9 50 2>/tmp/i2
a1=`cat /tmp/i2` && dialog --msgbox "Searching for backed-up location $b "
test ! -d $b1 && dialog --msgbox "$a1 does not exist ...back-up will not be done " 9 50 || dialog --msgbox " OK $a1 found .. we will go for back up " 9 50
tar cvzf $a0/backup.tar.gz $a1 && dialog --msgbox " congrats we have done back-up for u " 9 50 || dialog --msgbox "Sorry error occured" 9 50
rm -f /tmp/i1
rm -r /tmp/i2
just copy the above file to your Desktop to a file named "a"
and do the following steps
1. open your terminal and go for Desktop and type "sudo chmod +x a
2. then type ./a
will be seen as follow
#!/bin/bash
dialog --inputbox " Please Enter the location where back will be stored" 9 50 2>/tmp/i1
a0=`cat /tmp/i1`
test ! -d $a0 && dialog --msgbox " $a0 dont exit .. we will make for u " 9 50 && mkdir $a0 && dialog --msgbox "ok $a0 made " 9 50 || dialog --msgbox " Destination $a0 exist/or its cant be made ... we will go forward " 9 50
dialog --inputbox " Please Enter the location to back-up" 9 50 2>/tmp/i2
a1=`cat /tmp/i2` && dialog --msgbox "Searching for backed-up location $b "
test ! -d $b1 && dialog --msgbox "$a1 does not exist ...back-up will not be done " 9 50 || dialog --msgbox " OK $a1 found .. we will go for back up " 9 50
tar cvzf $a0/backup.tar.gz $a1 && dialog --msgbox " congrats we have done back-up for u " 9 50 || dialog --msgbox "Sorry error occured" 9 50
rm -f /tmp/i1
rm -r /tmp/i2
just copy the above file to your Desktop to a file named "a"
and do the following steps
1. open your terminal and go for Desktop and type "sudo chmod +x a
2. then type ./a
will be seen as follow
No comments:
Post a Comment