| 1 | # |
| 2 | # These functions override builtin BASH commands that change directories. |
| 3 | # |
| 4 | # This script should be added to either the system wide shell initialisation |
| 5 | # file (/etc/profile) or a user specific initialisation file (~/.bash_profile |
| 6 | # or ~/.profile). In addition, if you are using X, terminals you start up |
| 7 | # should be login terminals (typically -ls, --ls or something to that effect). |
| 8 | # |
| 9 | |
| 10 | cd() |
| 11 | { |
| 12 | builtin cd "$@" && eval "`ondir \"$OLDPWD\" \"$PWD\"`" |
| 13 | } |
| 14 | |
| 15 | pushd() |
| 16 | { |
| 17 | builtin pushd "$@" && eval "`ondir \"$OLDPWD\" \"$PWD\"`" |
| 18 | } |
| 19 | |
| 20 | popd() |
| 21 | { |
| 22 | builtin popd "$@" && eval "`ondir \"$OLDPWD\" \"$PWD\"`" |
| 23 | } |
| 24 | |
| 25 | # Run ondir on login |
| 26 | eval "`ondir /`" |