Created
April 17, 2011 18:43
-
-
Save cartazio/924342 to your computer and use it in GitHub Desktop.
new tab for iterm2
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
# First, get the directory for the new tab | |
if [[ $# == 0 ]]; then | |
ThisDirectory=$PWD | |
elif [[ $# == 1 && -d "$1" ]]; then | |
ThisDirectory="$@" | |
else | |
print "usage: ntab [directory]" | |
return 1 | |
fi | |
osascript <<-eof | |
tell app "Finder" | |
activate | |
tell application "iTerm" | |
-- make new terminal | |
tell the front terminal | |
activate current session | |
launch session "Default Session" | |
tell the current session | |
write text "cd \"$ThisDirectory\"" | |
end tell | |
end tell | |
end tell | |
tell application "Finder" | |
activate | |
end tell | |
tell application "iTerm" | |
activate | |
end tell | |
end tell | |
eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment