Guest User

Untitled

a guest
Jan 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #! /bin/bash
  2. clear
  3. restartt(){
  4. clear
  5. echo Press 'l' to list the files in a user defined directory
  6. echo Press 'b' to backup a user defined directory
  7. echo Press 'u' to to change a defined user''s password
  8. echo Press 'x' to simply Exit
  9. }
  10. scriptt(){
  11. echo ---
  12. echo 'Please Select: l, b, u, x:'
  13. read R
  14. case $R in
  15. # Case Letter 'l'
  16. l)
  17. echo 'please define a directory you would like to list'
  18. read LST
  19. cd $LST
  20. #echo 'You are in directory' pwd
  21. ls
  22. scriptt
  23. ;;
  24. # Case Letter 'b'
  25. b)
  26. scriptt
  27. ;;
  28. # Case Letter 'x'
  29. x)
  30. exit
  31. ;;
  32. # Case Letter 'u'
  33. u)
  34. echo Please type a users name to change their password:;read U
  35. if [ "$USER" = "$U" ];then
  36. passwd
  37. restartt
  38. scriptt
  39. elif [[ "$USER" != "root" ]];then
  40. echo 'You are not root, you MUST be root to change password of "' $U '"'
  41. echo 'So, Please Enter Root Password:'
  42. su -c "passwd $U"
  43. fi
  44. restartt
  45. scriptt
  46. ;;
  47. esac
  48. }
  49. restartt
  50. scriptt
Add Comment
Please, Sign In to add comment