Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EvanBurchard/100080 to your computer and use it in GitHub Desktop.
Save EvanBurchard/100080 to your computer and use it in GitHub Desktop.
Ripped off from:
http://ask.metafilter.com/87956/Please-help-me-make-my-terminal-work
on run argv
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down -- open a new tab
tell application "Terminal" to do script "cd " & item 1 of argv in front window -- change directory
end run
Save this script as /Users/[username]/scripts/newtab.scpt
Now you can open a new tab in the current directory using:
osascript ~/scripts/newtab.scpt `pwd`
Finally, add a line to ~/.bashrc which aliases this to something convenient, e.g.:
alias newtab='osascript ~/scripts/newtab.scpt `pwd`'
If you don't normally use a .bashrc, you might need to make a file ~/.bash_profile containing the single line:
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment