Skip to content

Instantly share code, notes, and snippets.

@caius
Forked from jnunemaker/instructions.txt
Created June 5, 2009 18:18
Show Gist options
  • Save caius/124412 to your computer and use it in GitHub Desktop.
Save caius/124412 to your computer and use it in GitHub Desktop.
1) Put terminal_clone_tab somewhere in
your path and make sure it is executable (I put it in ~/bin)
chmod u+x terminal_clone_tab
2) Then add the following alias (~/.bash_profile or something)
alias nt='terminal_clone_tab'
3) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
If there is an easier way to do this, let me know nunemaker@gmail.com.
#!/bin/sh
osascript <<-eof
tell application "Terminal"
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script with command "cd \"`pwd`\"; osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"k\" using command down'" in selected tab of the front window
return ""
end tell
eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment