Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Mount and unmount external drives easily via AppleScript ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mount and unmount external drives easily via AppleScript
Authored by: wallybear on Feb 13, '12 04:54:29PM

You can replace

awk '{ print substr($0,69,9) }'

with a cleaner

awk '{ print $NF }'

This command will do the same work (i.e. get the last word of the diskutil output line) without the need to specify the starting column and the lenght of the substring ( that could be different in future releases of diskutil).



[ Reply to This | # ]
Mount and unmount external drives easily via AppleScript
Authored by: Swordfish on Feb 14, '12 07:24:03PM

Whoa thanks! I wasn't aware of this. I know nothing about how "awk" works, I just looked at some example code and hacked it until I got the output I wanted.



[ Reply to This | # ]