Created
March 26, 2015 21:12
-
-
Save joxl/775c36e37d64f70626af to your computer and use it in GitHub Desktop.
do-in-new-term.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TERM_APP="iTerm" # change to your prefered terminal app | |
here=$(printf '%q' "$(pwd)") # quote it | |
command="$@" | |
osascript -e "$(cat <<EOF | |
on run argv | |
activate application "$TERM_APP" | |
tell application "System Events" to keystroke "n" using command down | |
if (count of argv) is not 0 then | |
tell application "iTerm" | |
tell session -1 of current terminal | |
repeat with i from 1 to (count argv) | |
write text "" & (item i of argv) & "" | |
end repeat | |
end tell | |
end tell | |
end if | |
end run | |
EOF)" "cd $here" "$command" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment