bash - 如何在 Bash 中禁用 shopt 选项?

标签 bash shopt

如何禁用 shopt选项,例如 extglob ?

我的 .bashrc 中有这个文件:

shopt -s extglob

最佳答案

使用 -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

    关于bash - 如何在 Bash 中禁用 shopt 选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44235158/

    相关文章:

    php - Bash 脚本不会在后台启动后执行命令

    linux - 在 curl 中拆分标题和内容

    bash - UNIX:使用 egrep 或 sed 查找字符串第一次出现的行?

    Bash 终端输出 - 突出显示包含一些文本的行

    python - Coverage.py:如何附加从 shell 脚本调用的多个 python 脚本的结果

    bash - 为什么非交互式 Bash shell 中的别名不起作用

    bash - 没有匹配文件时如何跳过for循环?

    arrays - nullglob 和数组

    python - 为什么从 python 调用 shopt 会失败?