Bash.Builtin.Shopt (Bash v0.6.0)

Copy Markdown View Source

shopt [-pqsu] [-o] [optname ...]

Toggle the values of variables controlling optional shell behavior.

Options:

  • -s - Enable (set) each optname
  • -u - Disable (unset) each optname
  • -q - Quiet mode: suppress output, exit status indicates whether option is set
  • -p - Print in reusable format (default when no optnames given)
  • -o - Operate on set -o options instead of shopt options

With no options, or with the -p option, a list of all settable options is displayed, with an indication of whether or not each is set.

Exit Status:

  • 0 if all optnames are enabled (with -s/-u, if operation succeeded)
  • 1 if any optname is not a valid option or is disabled (when querying)
  • 2 if an invalid option is given

Reference: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html Reference: https://cgit.git.savannah.gnu.org/cgit/bash.git/plain/builtins/shopt.def?h=bash-5.3