Search notes:

Bash - shopt

Setting an option with -s, unsetting it with -u.
assoc_expand_once If set, the shell suppresses multiple evaluation of associative array subscripts during arithmetic expression evaluation, while executing builtins that can perform variable assignments, and while executing builtins that perform array dereferencing.
autocd If set, a command name that is the name of a directory is executed as if it were the argument to the cd command (interactive shells only)
cdable_vars Assume argument to cd command that is not a directory to be the name of a variable (whose value contains the name of the directory to be cd'd to).
cdspell Correct minor typos in cd commands (interactive shells only)
checkhash Verify if commands found in hash table exist before trying to execute them.
checkjobs List status of any stopped and running jobs before exiting an interactive shell. Running jobs cause the exit to be deferred until a second exit is attempted without an intervening command.
checkwinsize Check window size after execution of a non-builtin command and adjust values of LINES and COLUMNS accordingly. (Enabled by default).
cmdhist Attempt to store multiple-line commands in the same history entry, allowing for easier re-editing of multi-line commands. (Enable by default - but only has effect if command line history is enabled).
compatXY Control compatiblity to a given bash version (XY).
complete_fullquote Quote metachars when performing filename/directory completion (set by default).
direxpand
dirspell Attempt to correct spelling on directory names during word completion.
dotglob Include filenames beginning with a . in the results of filename expansion. The filenames . and .. must always be matched explicitly.
execfail
expand_aliases Enabled by default for interactive shells.
extdebug If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell starts, identical to the --debugger option. (…)
extglob Enalbe extended pattern matching.
extquote If set, $'string' and $"string" quoting is performed within ${parameter} expansions enclosed in double quotes. (Enabled by default)
failglob Patterns which fail to match filenames during filename expansion result in an expansion error.
force_fignore Suffixex specified in FIGNORE shell variable cause words to be ignored when performing word completion. (Enabled by default)
globasciiranges If set, range expressions used in pattern matching bracket expressions behave as if in the traditional C locale when performing comparisons. That is, the current locale’s collating sequence is not taken into account, so b will not collate between A and B, and upper-case and lower-case ASCII characters will collate together.
globskipdots If set, filename expansion will never match the filenames . and .., even if the pattern begins with a .. This option is enabled by default.
globstar If set, the pattern ** used in a filename expansion context will match all files and zero or more directories and subdirectories. If the pattern is followed by a /, only directories and subdirectories match.
gnu_errfmt If set, shell error messages are written in the standard GNU error message format.
histappend If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file.
histreedit If set, and Readline is being used, a user is given the opportunity to re-edit a failed history substitution.
histverify If set, and Readline is being used, the results of history substitution are not immediately passed to the shell parser. Instead, the resulting line is loaded into the Readline editing buffer, allowing further modification.
hostcomplete If set, and Readline is being used, Bash will attempt to perform hostname completion when a word containing a @ is being completed. This option is enabled by default.
huponexit If set, Bash will send SIGHUP to all jobs when an interactive login shell exits.
inherit_errexit If set, command substitution inherits the value of the errexit option, instead of unsetting it in the subshell environment. This option is enabled when POSIX mode is enabled.
interactive_comments Allow a word beginning with # to cause that word and all remaining characters on that line to be ignored in an interactive shell. This option is enabled by default.
lastpipe If set, and job control is not active, the shell runs the last command of a pipeline not executed in the background in the current shell environment.
lithist If enabled, and the cmdhist option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible.
localvar_inherit If set, local variables inherit the value and attributes of a variable of the same name that exists at a previous scope before any new value is assigned. The nameref attribute is not inherited.
localvar_unset If set, calling unset on local variables in previous function scopes marks them so subsequent lookups find them unset until that function returns. This is identical to the behavior of unsetting local variables at the current function scope.
login_shell The shell sets this option if it is started as a login shell. The value may not be changed.
mailwarn If set, and a file that Bash is checking for mail has been accessed since the last time it was checked, the message "The mail in mailfile has been read" is displayed.
no_empty_cmd_completion If set, and Readline is being used, Bash will not attempt to search the PATH for possible completions when completion is attempted on an empty line.
nocaseglob Matches filenames in a case-insensitive fashion when performing filename expansion.
nocasematch Mmatches patterns in a case-insensitive fashion when performing matching while executing case or [[ conditional commands.
noexpand_translation Encloses the translated results of $"…" quoting in single quotes instead of double quotes. No effect if string is not translated.
nullglob If set, Bash allows filename patterns which match no files to expand to a null string, rather than themselves.
patsub_replacement Expand occurrences of & in the replacement string of pattern substitution to the text matched by the pattern. (Enabled by default(Enabled by default)
progcomp If set, the programmable completion facilities are enabled. This option is enabled by default.
progcomp_alias If set, and programmable completion is enabled, Bash treats a command name that doesn’t have any completions as a possible alias and attempts alias expansion. If it has an alias, Bash attempts programmable completion using the command word resulting from the expanded alias.
promptvars If set, prompt strings undergo parameter expansion, command substitution, arithmetic expansion, and quote removal after being expanded as described below. This option is enabled by default.
restricted_shell Set by bash if started in restricted mode.
shift_verbose If this is set, the shift builtin prints an error message when the shift count exceeds the number of positional parameters.
sourcepath Use value of PATH to find sourced file (. … builtin)
varredir_close Close file descriptors assigned using {varname} redirection syntax automatically instead of leaving them open when the command completes.
xpg_echo If set, the echo builtin expands backslash-escape sequences by default.

extglob

$ shopt -s extglob
Match all files without a or o in their filename:
echo !(*a*|*o*)
Match xy, xfooy, xfoofooy, xfoofoofooy, …
echo x*(foo)y
Match all files except the one named xy:
echo !(xy)
Match all files that do not start with xy:
echo !(xy*)

ignoreeof

shopt -s -o ignoreeof: Remain logged in even if accidentally hitting ctrl-d.
With ignoreeof, a shell must be exited with an explicit exit.
TODO:
$ shopt -s ignoreeof
bash: shopt: ignoreeof: invalid shell option name

See also

bash
set

Index