B.7. shopt Options

 < Day Day Up > 

The shopt options are set with shopt -sarg and unset with shopt -uarg. See Table B-8 for options to shopt. 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 B-8. Options to shopt


Meaning if set


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.


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.


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


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


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


Filenames beginning with a . are included in pathname expansion.


A non-interactive shell will not exit if it cannot execute the argument to an exec. Interactive shells do not exit if exec fails.


Aliases are expanded.


Behavior intended for use by debuggers is enabled. This includes: the -F option of declare displays the source filename and line number corresponding to each function name supplied as an argument; if the command run by the DEBUG trap returns a non-zero value, the next command is skipped and not executed; and if the command run by the DEBUG trap returns a value of 2, and the shell is executing in a subroutine, a call to return is simulated.


Extended pattern matching features are enabled.


Patterns which fail to match filenames during pathname expansion result in an expansion error.


The suffixes specified by the FIGNORE shell variable cause words to be ignored when performing word completion even if the ignored words are the only possible completions.


Shell error messages are written in the standard GNU error message format.


The history list is appended to the file named by the value of the variable HISTFILE when the shell exits, rather than overwriting the file.


If readline is being used, the opportunity is given for re-editing a failed history substitution.


If readline is being used, the results of history substitution are not immediately passed to the shell parser. Instead, the resulting line is loaded into the readline editing buffer, allowing further modification.


If readline is being used, an attempt will be made to perform hostname completion when a word beginning with @ is being completed.


bash will send SIGHUP to all jobs when an interactive login shell exits.


Allows a word beginning with # and all subsequent characters on the line to be ignored in an interactive shell.


If the cmdhist option is enabled, multiline commands are saved to the history with embedded newlines rather than using semicolon separators where possible.


If bash is started as a login shell. This is a read-only value.


If the file being checked for mail has been accessed since the last time it was checked, the message "The mail in mailfile has been read" is displayed.


If readline is being used, no attempt will be made to search the PATH for possible completions when completion is attempted on an empty line.


bash matches filenames in a case-insensitive fashion when performing pathname expansion.


Allows patterns which match no files to expand to null strings rather than to themselves.


Programmable completion facilities are enabled. Default is on.


Prompt strings undergo variable and parameter expansion after being expanded.


Set if the shell is started in restricted mode. The value cannot be changed.


The shift built-in prints an error if it has shifted past the last positional parameter.


The source built-in uses the value of PATH to find the directory containing the file supplied as an argument.


echo expands backslash-escape sequences by default.

     < Day Day Up > 

    Learning the bash Shell
    Learning the bash Shell: Unix Shell Programming (In a Nutshell (OReilly))
    ISBN: 0596009658
    EAN: 2147483647
    Year: 2005
    Pages: 139

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net