I would like to create a command like cd - (lets call it cdp) that will change directories to the last changed-to directory from another terminal window similar to the option to open a new terminal in the directory that previous window/tab was in (I don't see that option in Mac OS X terminal).
To do so I figure I could alter cd with something like alias cd='cd $1;echo $PWD > /tmp/CWD' and then add
alias cdp='cd `cat /tmp/CWD`
Can someone key in a better solution? Or, fill me in on an existing program, feature, etc., please let me know. On Mac OS X 10.6 with default terminal. Thanks.