set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
This should update the special variable $- with the enabled flags, eg:
$ echo $- himBHs
This should update the special variable SHELLOPTS with the enabled flags, eg:
$ echo $SHELLOPTS braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
Options:
-a- Mark variables which are modified or created for export.-b- Notify of job termination immediately.-e- Exit immediately if a command exits with a non-zero status.-f- Disable file name generation (globbing).-h- (Default on) Remember the location of commands as they are looked up.-k- All assignment arguments are placed in the environment for a command, not just those that precede the command name.-m- (Default on) Job control is enabled.-n- Read commands but do not execute them.-p- Turned on whenever the real and effective user ids do not match. Disables processing of the $ENV file and importing of shell functions. Turning this option off causes the effective uid and gid to be set to the real uid and gid.-t- Exit after reading and executing one command.-u- Treat unset variables as an error when substituting.-v- Print shell input lines as they are read.-x- Print commands and their arguments as they are executed.-B- (Default on) the shell will perform brace expansion-C- If set, disallow existing regular files to be overwritten by redirection of output.-E- If set, the ERR trap is inherited by shell functions.-H- (Unsupported) Enable ! style history substitution. This flag is on by default when the shell is interactive.-P- If set, do not follow symbolic links when executing commands such as cd which change the current directory.-T- If set, the DEBUG trap is inherited by shell functions.-- Assign any remaining arguments to the positional parameters. The-xand-voptions are turned off.-o option-nameSet the variable corresponding to option-name:allexport- same as-abraceexpand- same as-Bemacs- use an emacs-style line editing interface (Unsupported)errexit- same as-eerrtrace- same as-Efunctrace- same as-Thashall- same as-hhistexpand- same as-Hhistory- enable command historyignoreeof- the shell will not exit upon reading EOFinteractive-comments- allow comments to appear in interactive commands (Unsupported)keyword- same as-kmonitor- same as-mnoclobber- same as-Cnoexec- same as-nnoglob- same as-fnolog- currently accepted but ignorednotify- same as-bnounset- same as-uonecmd- same as-tphysical- same as-Ppipefail- the return value of a pipeline is the status of the last command to exit with a non-zero status, or zero if no command exited with a non-zero statusposix- change the behavior of bash where the default operation differs from the 1003.2 standard to match the standardprivileged- same as-pverbose- same as-vvi- use a vi-style line editing interface (Unsupported)xtrace- same as-x
Using + rather than - causes these flags to be turned off. The flags can also be used upon invocation of the shell. The current set of flags may be found in $-. The remaining n ARGs are positional parameters and are assigned, in order, to $1, $2, .. $n. If no ARGs are given, all shell variables are printed.
Reference: https://cgit.git.savannah.gnu.org/cgit/bash.git/plain/builtins/set.def?h=bash-5.3