emendelson
09-03-2004, 07:29 PM
In a thread on the System forum, Dale Mox very generously provided the way to get the diskname of a device (so that I could unmount the diskname from an Applescript), but he asked for help in one remaining problem, which is getting the diskname into a variable. I wonder if anyone in this forum can help with the question?
Here (cut on the dotted line) is Dale's message:
------------------------------------------------------------------------------
This will give you the diskname of the device (Given the name Silvery) :
mount | grep "Silvery" | cut -f1-1 -d " " | cut -f3-3 -d "/"
Another example:
mount | grep "I dont know" | cut -f1-1 -d " " | cut -f3-3 -d "/"
so set that to a variable, say devname and then use the command:
hdiutil detach $devname
Only thing is that I don't know how to set the output of a command to a variable... any help?
I tried this:
devname = 'mount | grep Silvery | cut -f1-1 -d " " | cut -f3-3 -d "/"'
but that was the string not the output
then I tried this:
mount | grep Silvery | cut -f1-1 -d " " | cut -f3-3 -d "/" > pbcopy
but that doesn't work
---------------------------------------------------------------------------
Is there any way to get that diskname output from the mount command into a variable? Any help will be gratefully received.
BTW, here is a link to the earlier thread:
http://forums.macosxhints.com/showthread.php?t=26597
Edward Mendelson
Here (cut on the dotted line) is Dale's message:
------------------------------------------------------------------------------
This will give you the diskname of the device (Given the name Silvery) :
mount | grep "Silvery" | cut -f1-1 -d " " | cut -f3-3 -d "/"
Another example:
mount | grep "I dont know" | cut -f1-1 -d " " | cut -f3-3 -d "/"
so set that to a variable, say devname and then use the command:
hdiutil detach $devname
Only thing is that I don't know how to set the output of a command to a variable... any help?
I tried this:
devname = 'mount | grep Silvery | cut -f1-1 -d " " | cut -f3-3 -d "/"'
but that was the string not the output
then I tried this:
mount | grep Silvery | cut -f1-1 -d " " | cut -f3-3 -d "/" > pbcopy
but that doesn't work
---------------------------------------------------------------------------
Is there any way to get that diskname output from the mount command into a variable? Any help will be gratefully received.
BTW, here is a link to the earlier thread:
http://forums.macosxhints.com/showthread.php?t=26597
Edward Mendelson