Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mmb
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmb/ea23a163461a1f21e64f to your computer and use it in GitHub Desktop.
Save mmb/ea23a163461a1f21e64f to your computer and use it in GitHub Desktop.
shell script that ejects the USB drive it's on
#!/bin/bash
set -e
COPY_PATH=/tmp/mount_mmb.sh
MOUNT_PATH=/Volumes/mmb
cat > $COPY_PATH << EOF
#!/bin/bash
set -e
echo put your script here
diskutil eject $MOUNT_PATH
rm $COPY_PATH
EOF
chmod u+x $COPY_PATH
exec $COPY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment