th0m45s5helby

raju CSE

Dec 27th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.73 KB | None | 0 0
  1. while true;
  2. do
  3. echo "menu"
  4. echo "1. copy file"
  5. echo "2. remove file"
  6. echo "3. move file"
  7. echo "4. quit"
  8. echo "5. enter your choice"
  9. read choice
  10. case "$choice" in
  11. 1)
  12.   echo "entr file name to copy"
  13.   read f1
  14.   echo "enter file name"
  15.   read f2
  16.   if [ -f $f1]
  17.   then
  18.     cp $f1 $f2
  19.   else
  20.     echo "$f1 does not exist"
  21.   fi
  22. ;;
  23. 2)
  24.   echo "enter file to remove"
  25.   read f1
  26.    if [ -f $f1]
  27.    then
  28.      rm -i $f1
  29.    else
  30.      echo "$f1 does not exist"
  31.    fi
  32. ;;
  33. 3)
  34.   echo "enter file name to move"
  35.   read f1
  36.   echo "enter destination"
  37.   read f2
  38.   if [ -f $f1]
  39.    then
  40.     if [ -d $f2]
  41.      then
  42.         mv $f1 $f2
  43.     else
  44.         echo "$f1 does not exist"
  45.   fi
  46. ;;
  47. 4)
  48.   echo "exit"
  49.   exit
  50. ;;
  51. esac
  52.  
  53. done
Advertisement
Add Comment
Please, Sign In to add comment