Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Osascript and ssh



Nigel Smith wrote:

Guys,

I'm trying to do the following from the command line:

ssh username@127.0.0.1 osascript -e 'return 2+2'

...but it fails. Indeed, any script entered using the "-e" flag will fail,
though substituting that with a text file is fine.

I'm wondering if there is a conflict because both ssh and osascript use the
"-e" flag? Can anyone suggest a way round this *without* sending the
osascript commands as a text file?


ssh expects a command, if any, as its last argument.
So, you have to explicitely make your

osascript -e 'return 2+2'

as a single argument for ssh.
In the precise case of your example, enclosing it with double quotes suffices:

ssh username@127.0.0.1 "osascript -e 'return 2+2'"

For more complex scripts to be executed that way, you would probably need to resort to "quoted form of" instead of just enclosing with double quotes, but the idea remains the same.

HTH,
Axel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Osascript and ssh (From: Nigel Smith <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.