shopt例如,如何禁用选项extglob?
我的.bashrc文件中有这个:
shopt -s extglob
Run Code Online (Sandbox Code Playgroud)
使用-u选项:
shopt -u extglob
Run Code Online (Sandbox Code Playgroud)
-s用于设置和-u用于取消设置。来自help shopt(或shopt --help在 BSD 系统上):
Options:
-o restrict OPTNAMEs to those defined for use with `set -o'
-p print each shell option with an indication of its status
-q suppress output
-s enable (set) each OPTNAME
-u disable (unset) each OPTNAME
Run Code Online (Sandbox Code Playgroud)
要了解如何以干净的方式进行 shopt,请参阅:
https://github.com/codeforester/base/blob/master/lib/shopt.sh