-
-
Save jwhitley/1266140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# VOLume Toggle => volt | |
# | |
# Usage: volt <volume> | |
# This script toggles the mountedness of the specified OS X disk | |
# volume using diskutil. The volume may be specified as the first | |
# parameter, or as the name of a symlink to this script. | |
volume=${1:=${0:t}} | |
mount | grep -q "/Volumes/${volume} *(" | |
if [[ $? -eq 0 ]]; then | |
# Volume is mounted; eject it | |
diskutil eject $volume | |
else | |
# Volume is unmounted; mount it | |
diskutil mount $volume | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment