Bash $OLDPWD


Example

OLDPWD (OLDPrintWorkingDirectory) contains directory before the last cd command:

~> $ cd directory
directory> $ echo $OLDPWD
/home/user