ex37.sh

来自「BASH Shell 编程 经典教程 《高级SHELL脚本编程》中文版」· Shell 代码 · 共 27 行

SH
27
字号
#!/bin/bashdir1=/usr/localdir2=/var/spoolpushd $dir1# 将自动运行一个 'dirs' (把目录栈的内容列到stdout上).echo "Now in directory `pwd`." # 使用后置引用的 'pwd'.# 现在对'dir1'做一些操作.pushd $dir2echo "Now in directory `pwd`."# 现在对'dir2'做一些操作.echo "The top entry in the DIRSTACK array is $DIRSTACK."popdecho "Now back in directory `pwd`."# 现在, 对'dir1'做更多的操作.popdecho "Now back in original working directory `pwd`."exit 0# 如果你不使用 'popd' 将会发生什么 -- 然后退出这个脚本?# 你最后将落在哪个目录中? 为什么?

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?