Shell Options
Bash provides a number of shell options, settings that you can change to modify the shell's behavior. You control these options with the shopt command (see the shopt entry in the later section Built-in Commands). The following descriptions describe the behavior when set. Options marked with a dagger (†) are enabled by default.
cdable_varsTreat a nondirectory argument to cd as a variable whose value is the directory to go to.
cdspellAttempt spelling correction on each directory component of an argument to cd. Allowed in interactive shells only.
checkhashCheck that commands found in the hash table still exist before attempting to use them. If not, perform a normal PATH search.
checkwinsizeCheck the window size after each command, and update LINES and COLUMNS if the size has changed.
cmdhist†Save all lines of a multiline command in one history entry. This permits easy re-editing of multiline commands.
dotglobInclude filenames starting with a period in the results of filename expansion.
execfailDo not exit a noninteractive shell if the command given to exec cannot be executed. Interactive shells do not exit in such a case, no matter the setting of this option.
expand_aliases†Expand aliases created with alias. Disabled in noninteractive shells.
extdebugEnable behavior needed for debuggers:
declare -Fdisplays the source filename and line number for each function name argument.When a command run by the
DEBUGtrap fails, the next command is skipped.When a command run by the
DEBUG ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access