shopt options

The shopt options are set with shopt -s arg and unset with shopt -u arg (see shopt options). Versions of bash prior to 2.0 had environment variables to perform some of these settings. Setting them equated to shopt -s. The variables (and corresponding shopt options) were: allow_null_glob_expansion (nullglob), cdable_vars (cdable_vars), command_oriented_history (cmdhist), glob_dot_filenames (dotglob), no_exit_ on_failed_exec (execfail). These variables no longer exist.

The options extdebug, failglob, force_fignore, and gnu_errfmt are not available in versions of bash prior to 3.0.

Table A-7. shopt options

Option

Meaning if set

cdable_vars

An argument to cd that is not a directory is assumed to be the name of a variable whose value is the directory to change to.

cdspell

Minor errors in the spelling of a directory supplied to the cd command will be corrected if there is a suitable match. This correction includes missing letters, incorrect letters, and letter transposition. It works for interactive shells only.

checkhash

Commands found in the hash table are checked for existence before being executed and nonexistence forces a $PATH search.

checkwinsize

Checks the window size after each command and, if it has changed, updates the variables $LINES and $COLUMNS accordingly.

cmdhist

Attempt to save all lines of a multiline command in a single history entry.

dotglob

Filenames beginning with a . are included in pathname expansion.

execfail

A noninteractive shell will not exit if ...

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