Bash Shell Options
A POSIX compliant shell can be configured with the set and unset builtins. To inspect the enabled options, use the $SHELLOPTS shell variable.
bash(1) expands on the set of configuration options. These options are set with the shopt builtins. To inspect the enabled options, use the $BASHOPTS shell variable.
Contents
Aliases
If expand_aliases is enabled, aliases are expanded. By default, this is enabled for interactive shells.
Comments
If interactive_comments is enabled, the comment character (#) works in interactive shells. This is enabled by default.
Compatibility Levels
bash(1) 4 introduced compatibility levels, wherein the behavior of the shell are modified.
shopt -e compat31 shopt -d compat31
The modes available through the shopt builtin are:
compat31
compat32
compat40
compat41
compat42
compat43
compat44
A shell only has one compatibility level, so each mode is mutually exclusive.
From bash(1) 4.3+, use of the $BASH_COMPAT shell variable is preferred.
Completion
If progcomp is enabled, programmable completion is used. This is enabled by default.
If progcomp_alias is enabled, when completion fails for a word, the word is checked for an alias. If an alias is registered, completion is re-attempted based on the aliased value.
If force_fignore is enabled and the $FIGNORE shell variable is set, the filtered filenames will be ignored by completion even if they are the only possible expansions. This is enabled by default.
If hostcomplete is enabled, hostname completion will be tried for any word containing @. This is enabled by default.
Extended Debugging Mode
extdebug
History
If history is enabled, the history of commands is available for editting and re-execution. This behavior is configured with a set of shell variables.
If cmdhist is enabled and command history is enabled, multi-line commands are collapsed to a single line when saving into history. This is enabled by default.
If lithist is enabled as well as cmdhist, multi-line commands are recorded in history with embedded newlines rather than semicolons.
shopt -e lithist shopt -d lithist
If histappend is set, the history file is appended to rather than overwritten when the shell exits.
shopt -e histappend shopt -d histappend
If histreedit is set and readline(3) is available, history can be re-editted.
shopt -e histreedit shopt -d histreedit
If histverify is set, when a command is expanded with history substitution, the prompt reloads with the updated content (as opposed to the shell executing the updated command immediately).
shopt -e histverify shopt -d histverify
Prompts
If promptvars is enabled, prompt strings undergo expansion after sequences are expanded. This is enabled by default.
Quoting
If extquote is enabled, ANSI quoting and local translation quoting are performed within parameter expansion. This is enabled by default.
If complete_fullquote is enabled, filenames containing special characters are quoted during filename expansion. This is enabled by default.
Window Size
If checkwinsize is enabled, bash(1) checks the window size after every (non-builtin) command. This triggers updates to the $LINES and $COLUMNS shell variables. By default, this is enabled for interactive shells.