Last active
September 24, 2020 12:34
-
-
Save nikolay-n/dda75f1078fc8d51ed443db3f55df52b to your computer and use it in GitHub Desktop.
Perl one-liner to detach all mounted dmg
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
perl -e '$h="hdiutil";$m=`$h info`;@m=split(/=+/,$m);for(reverse(@m)){/\.dmg$/m and m~/dev/d[\w]+\t[^\t]+\t(/.+)$~m and `$h detach -force "$1"` }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment