DIRSTACK
An array variable (see Arrays below) containing the current
contents of the directory stack. Directories appear in the stack
in the order they are displayed by the dirs builtin. Assigning to
members of this array variable may be used to modify directories
already in the stack, but the pushd and popd builtins must be used
to add and remove directories. Assignment to this variable will
not change the current directory. If DIRSTACK is unset, it loses
its special properties, even if it is subsequently reset.
$ help popd | head -5
popd: popd [-n] [+N | -N]
Remove directories from stack.
Removes entries from the directory stack. With no arguments, removes
the top directory from the stack, and changes to the new top directory.
$ help pushd | head -5
pushd: pushd [-n] [+N | -N | dir]
Add directories to stack.
Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
摘录 bash 手册页popd
并且pushd
是内置在 Bash 中的命令,它们不是作为真正的二进制文件存在于 HDD 上的实际可执行文件。所有内置命令的完整列表可在 Bash 手册页以及此处 - http://structure.usc.edu/bash/bashref_4.html中找到。
您还可以使用
补偿 使能够compgen -b
或enable
获取所有这些内置函数的完整列表:此外,如果您想获得有关内置函数的帮助,可以使用以下
help
命令: