The environmental variable in $PWD
has the current working directory. Is there a variable that contains the previous directory? If there is not, how might one be created?
I think this could be useful.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityYes, there is. man bash
will lead you to
OLDPWD The previous working directory as set by the cd command.
pushd
and popd
to manipulate this stack. See man bash
for details.
pushd
.