Skip to content

Instantly share code, notes, and snippets.

@sushihangover
Created September 20, 2015 07:55
Show Gist options
  • Save sushihangover/7563e1707e98cdf2b285 to your computer and use it in GitHub Desktop.
Save sushihangover/7563e1707e98cdf2b285 to your computer and use it in GitHub Desktop.
#!/bin/bash
read -r -d '' script <<'EOF'
on run argv
tell application "iTerm"
activate
set myterm to (make new terminal)
tell myterm
launch session "Default"
tell the last session
repeat with arg in argv
say arg
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
echo "$script" | osascript ``-'' $@
Copy link

ghost commented Jan 29, 2016

thx

@focs
Copy link

focs commented Jan 23, 2017

I had to change te least line to echo "$script" | osascript ``-'' "$@" to make it work for me. Otherwise, it would split the commands (i.e. "ls -l" into "ls" and "-l").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment