Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a shopt option in Bash?

Tags:

bash

shopt

How to disable a shopt option, for example extglob?

I have this in my .bashrc file:

shopt -s extglob
like image 674
learningbee Avatar asked Feb 05 '23 09:02

learningbee


1 Answers

Use the -u option:

shopt -u extglob
  • -s is for setting and -u is for unsetting.

From help shopt (or shopt --help as well on BSD systems):

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

To see how to do shopt in a clean way, see this:

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

like image 175
codeforester Avatar answered Feb 08 '23 16:02

codeforester