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_vars

Treat a nondirectory argument to cd as a variable whose value is the directory to go to.

cdspell

Attempt spelling correction on each directory component of an argument to cd. Allowed in interactive shells only.

checkhash

Check that commands found in the hash table still exist before attempting to use them. If not, perform a normal PATH search.

checkwinsize

Check 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.

dotglob

Include filenames starting with a period in the results of filename expansion.

execfail

Do 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.

extdebug

Enable behavior needed for debuggers:

  • declare -F displays the source filename and line number for each function name argument.

  • When a command run by the DEBUG trap fails, the next command is skipped.

  • When a command run by the DEBUG ...

Get bash Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.