Sakarias NettJournal

Unmout all harddrives

Kom over dette lille bash skriptet på MacBreak Weekly.

#!/bin/bash
for i in $( disktool -l | grep "Mountpoint = '/" | sed s/^.*Mountpoint\ =\ \'// | sed s/\',.*// | sed 's/ /\\/g' )
do
    case "${i}" in 
        # Add any volumes you might want to skip as alternate case, for example the root volume: /)
        ;;
        # This case will take care of all the others, the drives you do want to eject:
        *)
            umount "`echo $i | sed 's/\\\/ /g'`" && echo "$i unmounted"
            diskutil eject "`echo $i | sed 's/\\\/ /g'`" && echo "$i unmounted"
            ;;
        esac
done

Følg med på Twitter for oppdateringer på nye posteringer.