Skip to content

Instantly share code, notes, and snippets.

@naaman
Created May 11, 2012 22:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naaman/2662936 to your computer and use it in GitHub Desktop.
Save naaman/2662936 to your computer and use it in GitHub Desktop.
Open iTerm2 Pane and Execute a Command
pane() {
local currentDir=$(pwd)
osascript <<EOD
tell application "iTerm"
tell application "System Events" to keystroke "d" using command down
tell current session of current terminal
write text "cd $currentDir"
write text "$@"
end tell
end tell
EOD
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment