Name

shopt

Synopsis

    shopt [-opqsu] [option]

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

Options

-o

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

-p

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

-q

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.

-s

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

-u

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.

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

Get Unix in a Nutshell, 4th Edition 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.