$dirstack  –  Directory Stack

$dirstack contains the elements of the directory stack. It does not contain the current working directory, in contrast to the dirs builtin command.

Examples

Change working directory, print the directory stack, change back to the previous directory
1
2
3
4
cd ~
pushd /usr/bin
declare dirstack
popd
Output:
1
2
3
4
/usr/bin ~
dirstack=( /home/user )
~
/home/user
BashSupport Pro is a Zsh IDE with support for $dirstacktry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal