Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filePath=""
- newTarget=""
- compress=""
- valid=false
- while [ $valid = false ];
- do
- echo "Enter file or folder location: "
- read filePath
- if [ -e $filepath ] || [ -d $filepath ]; then
- $valid=true
- else
- echo "Invalid file or folder location. "
- fi
- done
- valid=false
- while [ $valid = false ];
- do
- echo "Enter location to save backup: "
- read newTarget
- if [ -d $filepath ]; then
- $valid=true
- else
- echo "Folder location. "
- fi
- done
- valid=false
- while [ $valid = false ];
- do
- echo "Compress the backup? (y/n) "
- read compress
- if [ $compress = "y" ] then
- $valid=true
- tar $filePath $newTarget
- elif [ $compress = "n" then
- $valid=true
- cp $filePath $newTarget
- else
- echo "Invalid input, enter (y/n)
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement