O'Reilly logo

bash Cookbook by Cameron Newham, JP Vossen, Carl Albing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 it cannot execute ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required