Talk:Shopt command

From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

Toggle the values of variables controlling optional shell behavior. 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. The -p option causes output to be displayed in a form that may be reused as input. Other options have the following meanings:

   -s
       Enable (set) each optname. 
   -u
       Disable (unset) each optname. 
   -q
       Suppresses normal output (quiet mode); the return status indicates whether the optname is set or unset. If multiple optname arguments are given with -q, the return status is zero if all optnames are enabled; non-zero otherwise. 
   -o
       Restricts the values of optname to be those defined for the -o option to the set builtin. 
   If either -s or -u is used with no optname arguments, the display is limited to those options which are set or unset, respectively. Unless otherwise noted, the shopt options are disabled (unset) by default.
   The return status when listing options is zero if all optnames are enabled, non-zero otherwise. When setting or unsetting options, the return status is zero unless an optname is not a valid shell option.