Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating osascript one-line scripts, on mac osx 10.10.2

Tags:

osascript

I'm new to terminal scripts and I'm trying to convert

osascript -e 'tell app "Terminal" 
do script "ssh -t jgreen@dev-jgreen-bs pwd"
end tell' 

This works with multiline as so but I want a one-line script, but I can't quite get it right. I keep getting a 2741 error, I know it is syntax I am failing with.

I have tried /, ,, \n,-e,&,to as separators.

like image 256
James Green Avatar asked Oct 18 '25 01:10

James Green


1 Answers

You'll need to add a few sections to this one line command:

osascript -e 'tell app "Terminal"' -e 'do script "ssh -t jgreen@dev-jgreen-bs pwd"' -e 'end tell'

Each line in an applescript needs to be broken into sections on a single line osascript command in terminal. You add the "-e" for each section and the single apostrophe.

Hope this helps.

like image 118
AbsterT Avatar answered Oct 19 '25 19:10

AbsterT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!