How do i put double quotes in an applescript using the do shell script command for an ssh command?

Hi Guys,

here is my code:


do shell script "ssh USER@HOST 'osascript -e 'tell application \"iCamSource.app\" to Quit''"

here is my error:

User uploaded file

Does anyone have any ideas what is going on or what i should do? Also, I have used the above highlighted backslashes to ensure that my quotes are executed in the shell script not the applescript. Please help me someone 😟

MacBook Pro, iOS 5.1

Posted on May 12, 2013 5:10 AM

Reply
1 reply

May 12, 2013 6:51 AM in response to Benjamyn

Hello


Try this:


do shell script "ssh USER@HOST 'osascript -e '\\''tell application \"iCamSource.app\" to quit'\\'"


The following code illustrates the composition:


set ascr to "osascript -e 'tell application \"iCamSource.app\" to quit'"
set sh to "ssh USER@HOST " & ascr's quoted form
--return sh -- "ssh USER@HOST 'osascript -e '\\''tell application \"iCamSource.app\" to quit'\\'''"
do shell script sh


*I removed the last '' (quote quote) in the first code because it is redundant in this case. (It is a residual product of "quoted form" algorithm which you may safely leave it alone.)


Simpler local test code is something like this:


set ascr to "osascript -e 'tell application \"Finder\" to return version'"
set sh to "/bin/bash -c " & ascr's quoted form
--return sh -- "/bin/bash -c 'osascript -e '\\''tell application \"Finder\" to return version'\\'''"
do shell script sh


Hope this helps

H

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do i put double quotes in an applescript using the do shell script command for an ssh command?

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