Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #!/bin/bash
  2. # simple menu to do various functions
  3.  
  4. while [ answer != "0" ]
  5. do
  6. clear
  7. echo "Select from the following functions"
  8. echo" 0 Blablabla"
  9. echo" 1 User"
  10. echo" 2 rasda"
  11. echo" 3 asdasd"
  12. echo" 4 exit"
  13. echo" A Backup E: zipped to G:"
  14. read -p " ?" answer
  15. case $answer in
  16. 0) break ;;
  17. 1) if [ $(id -u) -eq 0 ]; then
  18. read -p "Enter username : " username
  19. read -s -p "Enter password : " password
  20. egrep "^$username" /etc/passwd >/dev/null
  21. if [ $? -eq 0 ]; then
  22. echo "$username exists!"
  23. exit 1
  24. else
  25. pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
  26. useradd -m -p $pass $username
  27. [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
  28. fi
  29. else
  30. echo "Only root may add a user to the system"
  31. exit 2
  32. fi
  33.  
  34. ;;
  35. 2) rm -rf /disks/D/"System Volume Information"
  36. rm -rf/disks/E/"System Volume Information"
  37. rm -rf /disks/F/"System Volume Information"
  38. rm -rf /disks/G/"System Volume Information"
  39. ;;
  40. 3) escputil -q --raw-device=/dev/usb/lp1 -i
  41. ;;
  42. 4) break ;;
  43. A|a) echo "enter zip archive name (eyymmdd)"
  44. read name
  45. cd /disks/E/
  46. zip -r /disks/G/$name.zip *
  47. cd ~/
  48. ;;
  49. *) break ;;
  50. esac
  51. echo "press RETURN for menu"
  52. read key
  53. done
  54. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement