Up Next Previous

Directory stack substitution (+)

The directory stack is a list of directories, numbered from zero, used by the pushd, popd and dirs builtin commands (q.v.). dirs can print, store in a file, restore and clear the directory stack at any time, and the savedirs and dirsfile shell variables can be set to store the directory stack automatically on logout and restore it on login. The dirstack shell variable can be examined to see the directory stack and set to put arbitrary directories into the directory stack.

The character `=' followed by one or more digits expands to an entry in the directory stack. The special case `=-' expands to the last directory in the stack. For example,

> dirs -v
0 /usr/bin
1 /usr/spool/uucp
2 /usr/accts/sys
> echo =1
> echo =0/calendar
> echo =-

The noglob and nonomatch shell variables and the expand-glob editor command apply to directory stack as well as filename substitutions.

Up Next Previous