Hot answers tagged


You may find the shell $OLDPWD shell variable useful (defined by POSIX). For example, you could define a shell function overriding the original cd command: cd() { command cd "$@" && printf '%s -> %s\n' "${OLDPWD}" "${PWD}"; } Excerpt from the Unix man page you should read: If, during the execution of the above steps, the PWD environment ...

Only top voted, non community-wiki answers of a minimum length are eligible