Skip to content

Instantly share code, notes, and snippets.

@ejel
Created July 11, 2011 23:41
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 ejel/1077064 to your computer and use it in GitHub Desktop.
Save ejel/1077064 to your computer and use it in GitHub Desktop.
Eject connected external devices
#!/usr/bin/env zsh
for d in /Volumes/*
do
if diskutil info $d | grep -P "\bEjectable:\s+Yes" > /dev/null
then
diskutil eject $d
fi
done
growlnotify -m "External devices ejected."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment