Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set -e
- sudo umount /drive || [ $? -eq 0 ]
- echo do stuff
- if sudo mount /drive; then
- : # exit status 0
- else
- rc=$?
- [ $rc -ne 127 ] && exit $rc
- fi
- env status=0 bash -e -c '
- mycmd() { return $1; }
- if mycmd $status; then
- :
- else
- rc=$?
- [ $rc -ne 127 ] && exit $rc
- fi
- echo OK
- '
- sudo umount /drive
- case $? in
- 0)
- ;;
- 127)
- ;;
- *)
- echo 'bailing!'
- exit 1
- ;;
- esac
- echo 'doing more stuff'
Add Comment
Please, Sign In to add comment