Guest User

Untitled

a guest
Jan 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. set -e
  2. sudo umount /drive || [ $? -eq 0 ]
  3. echo do stuff
  4.  
  5. if sudo mount /drive; then
  6. : # exit status 0
  7. else
  8. rc=$?
  9. [ $rc -ne 127 ] && exit $rc
  10. fi
  11.  
  12. env status=0 bash -e -c '
  13. mycmd() { return $1; }
  14. if mycmd $status; then
  15. :
  16. else
  17. rc=$?
  18. [ $rc -ne 127 ] && exit $rc
  19. fi
  20. echo OK
  21. '
  22.  
  23. sudo umount /drive
  24.  
  25. case $? in
  26.  
  27. 0)
  28. ;;
  29. 127)
  30. ;;
  31.  
  32. *)
  33. echo 'bailing!'
  34. exit 1
  35. ;;
  36. esac
  37.  
  38. echo 'doing more stuff'
Add Comment
Please, Sign In to add comment