Adding this to .bashrc:

#call pushd on every cd
function cd() {
     oldir=`pwd`
     builtin cd "$@" || return $?
     newdir=`pwd`
     builtin cd "$oldir"
     pushd "$newdir" > /dev/null
}

always calls pushd with cd so you always get the benefit of using popd
to go back up the directory changes.

Any questions/suggestions/improvements welcome :)

Isaac

* beware gmail header *

Reply via email to