Subscribe
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
osascript ~/scripts/newtab.scpt `pwd`alias newtab='osascript ~/scripts/newtab.scpt `pwd`'source ~/.bashrcnewtab should do roughly what you want.cd "`cat ~/.lwd`"Seems to have the desired effect... when you open a new window/tab, you're in whatever directory you last changed to. Not the one in the current tab, unfortunately (you could have switched tabs since the last time you cd'd... terminal doesn't know what directory you're in in any of its windows) but it may be close enough.
alias precmd 'echo -n "$cwd" >~/.lwd'
You are not logged in, either login or create an account to post comments
Perhaps you could use the /usr/bin/osascript utility to tell Terminal to create a new tab in the current document of the window (or however it's referenced, this can get weird sometimes), and then issue the appropriate cd command to the new tab.
Use Script Editor.app to open the Terminal dictionary and peek around at what it supports, then have a look around MacScripter.net and its forums for examples of scripting Terminal.app.
posted by Mikey-San at 11:03 PM on April 4