New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

AppleScript issue


Post Reply New Thread Subscribe

 
Thread Tools
huntson

 
Member Since: Sep 02, 2012
Posts: 1
huntson is on a distinguished road

huntson is offline
I am fairly new to AppleScript and need some help with the following line:


do shell script "diskutil unmount \"Volumes/" & bob


Bob is the variable of the name of the volume I want to pass to the shell script. No matter how I do it - I cannot get the end of the line correct in terms of quotes.* I get the following error in its current state

sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
Show the code for how you have set the bob variable, as I'm guessing
that is where the problem is.

Regards Mark
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,352
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
You need to add a quotation mark at the end.

Pretend bob has a value of external_disc. Let's construct the command now, replacing bob with the value:
Code:
do shell script "diskutil unmount \"Volumes/external_disc"
See the problem? You've started putting quotation marks around the volume name but didn't put a closing one. You've also forgotten to put a forward slash before Volumes.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
As vansmith has eluded too, you have three quotation marks, and also
a backslash before Volumes, that should be a forward slash.

Try something like this.

Code:
set myVolume to "bob"
do shell script "diskutil unmount /Volumes/" & myVolume
Regards Mark
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,352
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
The backslash before the second quotation mark may be there on purpose though if he's trying to escape it so as to put the volume path in quotation marks (perhaps the volume name has a space?).

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 170
Mark FX has a spectacular aura about

Mark FX is offline
That's possible, but he still needs to have forward slash in front of Volumes, to indicate
its off of the root path.
Also I suspect he is building his bob variable as a alias HFS type path, instead of a POSIX
style path, but we'll see.

Mark
QUOTE Thanks

Post Reply New Thread Subscribe


« Where to get Darwin kernel source? | Xcode Tutorial »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Disk Error, then FOLDER WITH QUESTION MARK ISSUE. rohit.dhamija Apple Notebooks 1 09-14-2010 02:52 PM
I Pod touch - photos issue andrewmpalmer iPod Hardware and Accessories 2 09-06-2010 04:41 PM
Apple deleting posts again - iPhone 4 antenna issue robains iPhone Hardware and Accessories 7 07-23-2010 12:23 PM
another battery issue rothko Apple Notebooks 8 05-28-2008 10:36 PM
Issue with Mac Safari browser harryindia OS X - Apps and Games 4 11-21-2006 07:31 PM

All times are GMT -4. The time now is 02:20 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?