Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. is_mounted=false
  3.  
  4. if mount | grep -qs sda1
  5. then
  6. echo "sda1 is mounted. Type <u> to unmount; Enter to quit. "
  7. is_mounted=true
  8.  
  9. else
  10. echo "sda1 is not mounted. Type <m> to mount; Enter to quit. "
  11. fi
  12.  
  13. read choice
  14.  
  15. if [[ $choice == "u" ]] && [[ "$is_mounted" == true ]]
  16. then
  17. if sudo umount /dev/disk/by-uuid/<here_goes_uuid>
  18. then
  19. echo "ESP unmounted."
  20. sleep 0.4
  21. fi
  22.  
  23. elif [[ $choice == "m" ]] && [[ "$is_mounted" == false ]]
  24. then
  25. if sudo mount /dev/disk/by-uuid/<here_goes_uuid>
  26. then
  27. echo "ESP mounted."
  28. sleep 0.4
  29. fi
  30.  
  31. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement