shopt [-opqsu] [option]

Bash only. Sets or unsets shell options. With no options or just -p, prints the names and settings of the options.



Each option must be one of the shell option names for set -o, instead of the options listed in the next section.


Print the option settings as shopt commands that can be reread later.


Quiet mode. The exit status is zero if the given option is set, nonzero otherwise. With multiple options, all of them must be set for a zero exit status.


Set the given options. With no options, prints only those that are set.


Unset the given options. With no options, prints only those that are unset.

Settable Shell Options

The following descriptions describe the behavior when set. Options marked with a dagger (|) are enabled by default.


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


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


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


Check the window size after each command and update LINES and COLUMNS if the size has changed.


Save all lines of a multiline command in one history entry. This permits easy re-editing of multiline commands.


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


Do not exit a noninteractive ...

Get Unix in a Nutshell, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.