如何在Bash中禁用shopt选项?

时间:2017-05-29 05:28:34

标签: bash shopt

如何停用shopt选项,例如extglob

我在.bashrc文件中有这个:

shopt -s extglob

1 个答案:

答案 0 :(得分:3)

使用-u选项:

shopt -u extglob
  • -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

要了解如何以干净的方式购买shopt,请参阅:

https://github.com/codeforester/base/blob/master/lib/shopt.sh