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 entry for shopt). The following descriptions describe the behavior when set. Options marked with a dagger (†) are enabled by default:

autocd

When the first word of a simple command cannot be executed, try to cd to it.

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.

checkjobs

When an attempt is made to exit a shell and there are stopped or running background jobs, the shell prints There are running jobs. and a list of jobs and their statuses. A second exit attempt (such as typing EOF again) causes the shell to exit.

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.

compat31

Mutually exclusive with the compat32 and compat40 options. Restore the behavior of the =~ operator for the [[ ]] command whereby the righthand side is always treated as a regular expression to be matched. In addition, the < and > operators ignore the locale when doing string ...

Get bash Pocket 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.