shopt [-pqsu] [-o] <OPTNAME...>
The shopt builtin manages shell options, a set of boolean (on/off) configuration variables that control the behaviour of the shell.
Some of these option can also be set with an option to the set builtin.
The options are named by <OPTNAME...>.
| Option | Description |
|---|---|
-o | Restrict the values of <OPTNAME...> to only those also known by the set builtin |
-p | Print all shell options and their current value. Default. |
-q | Quiet mode. Set exit code if named option is set. For multiple options: TRUE if all options are set, FALSE otherwise |
-s | Enable (set) the named options |
-u | Disabe (unset) the named options |
If only -s or -u are given, only the currently enabled (-s) or disabled (-u) options are printed.
When listing options, the exit code is TRUE (0), if all options are enabled, FALSE otherwise.
When setting/unsetting an option, the exit code is TRUE unless the named option doesn't exitst.