Name
shopt
Synopsis
shopt [-opqsu] [options]Set or unset shell options. With no options or just -p, print the option names and whether they are set or not.
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, print only those that are set.
- -u
Unset the given options. With no options, print only those that are unset.
Settable shell options
The following list describes the behavior when set. Options marked with an asterisk (*) are enabled by default.
- autocd
Attempt to cd to a directory that is given as a command name. Allowed in interactive shells only.
- 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
Display the status of any running or stopped jobs before exiting an interactive shell.
- 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. ...
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