Is There a Previous-Directory Variable?
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...
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.
1 Answer
Yes, there is. man bash will lead you to
OLDPWD The previous working directory as set by the cd command.