Reputation: 21237
I'm trying to write a short shell script to open a new terminal window and launch a program. Here is what I have:
osascript <<END
tell application "Terminal"
make new window
activate
set contents of window to "./hello" & return
end tell
END
execution error: Terminal got an error: AppleEvent handler failed. (-10000)
Can anyone tell me how to do this? In a perfect world, I'd also like this script to run on Linux, so if there is a method that will be portable, that would be preferable.
Thank you!
Upvotes: 4
Views: 5487
Reputation: 27593
The do script
command runs a command in a new Terminal window:
osascript -e 'tell app "Terminal" to do script "uptime"'
Upvotes: 5
Reputation: 1482
something like this :
osascript<<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "./hello" in window 1
end tell
EOF
Upvotes: 1