Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Spaces in shell script application?

how do I signify a space in the application name in the following script:


do shell script "/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner -s -r"


User uploaded file

MacBook Pro, OS X Mountain Lion (10.8.2), 2.3 GHz i5, 4GB RAM, OCZ 120GB SSD

Posted on Feb 3, 2013 7:38 AM

Reply
Question marked as Best reply

Posted on Feb 3, 2013 7:54 AM

Use:


do shell script "'/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner' -s -r"


or:


do shell script "/Applications/Plex\\ Media\\ Server.app/Contents/MacOS/Plex\\ Media\\ Scanner -s -r"


(75942)

7 replies

Feb 3, 2013 7:54 AM in response to MacMan240

You can escape spaces in the path with a backslash, but since the backslash is also the escape character you need to escape it as well, so you wind up with:

/Applications/Plex\\ Media\\ Server.app/Contents/MacOS/Plex\\ Media\\ Scanner


Usually it is easier to use quoted form of, and let the system figure it out:


setsomepathtoquoted formof"/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner"

do shell scriptsomepath & " -s -r"

Spaces in shell script application?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.