[launchd-dev] Launch shell script when volume is mounted

Matt Calthrop matt at calthrop.com
Wed Apr 20 13:56:57 PDT 2011


Thanks Luke... looks like that might work – and initial tests indicate it
even works for my SD card whose volume name contains a space.

Never seen that bash syntax before... thank you!

Matt


On 20 April 2011 17:35, Luke Scott <luke at cywh.com> wrote:

> Assuming "df" follows the same rules as mount (last mounted is last in the
> list), this may be cleaner:
>
> #!/bin/bash
> volume=`df`
>
> volume=${volume##*%}
>
> echo $volume
>
> Luke Scott
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20110420/737e0932/attachment.html>


More information about the launchd-dev mailing list