Advertisement
Guest User

restore test

a guest
Nov 23rd, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.64 KB | None | 0 0
  1. #!/bin/bash
  2. if [ "$1" == "-n" ]
  3. then
  4.   cd /home/ian/dustbin
  5.   restore =`grep $2 /home/ian/store`
  6.   filename = `basename "$restore"`
  7.   echo "Where do you want to save to?"
  8.   read location
  9.   location1 = `readlink -f $location`
  10.   if [[ -e "$filename" ]]; then
  11.     echo FILE NOT FOUND
  12.     fi
  13.   mv -i $filename "$location1"/$filename
  14. else
  15. ##if the restore script is run without the -n switch the file will be restored to its original location
  16.   cd /home/ian/dustbin
  17.   restore = `grep $1 /home/ian/store`
  18.   filename=`basename "$restore"`
  19.   if [[ -e "$filename" ]]; then
  20.     echo FILE NOT FOUND
  21.     fi
  22.   mv -i $filename $location
  23. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement