OLDPWD
(path)Return the home directory for the current session user
OLDPWD
return the previous directory.
This variable exists to support POSIX, however the idiomatic way to
access this same data is via $PWDHIST
.
This is a reserved variable so it cannot be changed.
PWDHIST
is an array that holds the entire
PWD
history rather than just the previously accessed
path.
OLDPWD
reads PWDHIST
, so if
PWDHIST
is overwritten, this will affect the value of
OLDPWD
as well.
If a previous directory cannot be determined, then
OLDPWD
will error. For example:
» cd $OLDPWD
Error in `cd` (0,1): cannot assign value to $OLDPWD: already at oldest entry in $PWDHIST
> Expression: cd $OLDPWD
> : ^
> Character : 9
PWDHIST
(json):
History of each change to the sessions working directoryPWD
(path): Current
working directorypath
: Structured object
for working with file and directory pathsThis document was generated from gen/variables/OLDPWD_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Sat Aug 23 22:28:13 UTC 2025 against commit ad23f13ad23f131bfecd82ea8a12d9b3e92aab5d8398ae9.
Current version is 7.0.2129 (website) which has been verified against tests cases.