summaryrefslogtreecommitdiff
path: root/devdocs/bash/the-shopt-builtin.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/bash/the-shopt-builtin.html')
-rw-r--r--devdocs/bash/the-shopt-builtin.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/devdocs/bash/the-shopt-builtin.html b/devdocs/bash/the-shopt-builtin.html
new file mode 100644
index 00000000..eddfc20b
--- /dev/null
+++ b/devdocs/bash/the-shopt-builtin.html
@@ -0,0 +1,70 @@
+<h1 class="subsection">The Shopt Builtin</h1> <p>This builtin allows you to change additional shell optional behavior. </p> <dl compact> <dt id="index-shopt"><span><code>shopt</code></span></dt> <dd>
+<div class="example"> <pre class="example">shopt [-pqsu] [-o] [optname …]
+</pre>
+</div> <p>Toggle the values of settings controlling optional shell behavior. The settings can be either those listed below, or, if the <samp>-o</samp> option is used, those available with the <samp>-o</samp> option to the <code>set</code> builtin command (see <a href="the-set-builtin">The Set Builtin</a>). With no options, or with the <samp>-p</samp> option, a list of all settable options is displayed, with an indication of whether or not each is set; if <var>optname</var>s are supplied, the output is restricted to those options. The <samp>-p</samp> option causes output to be displayed in a form that may be reused as input. Other options have the following meanings: </p> <dl compact> <dt><span><code>-s</code></span></dt> <dd>
+<p>Enable (set) each <var>optname</var>. </p> </dd> <dt><span><code>-u</code></span></dt> <dd>
+<p>Disable (unset) each <var>optname</var>. </p> </dd> <dt><span><code>-q</code></span></dt> <dd>
+<p>Suppresses normal output; the return status indicates whether the <var>optname</var> is set or unset. If multiple <var>optname</var> arguments are given with <samp>-q</samp>, the return status is zero if all <var>optname</var>s are enabled; non-zero otherwise. </p> </dd> <dt><span><code>-o</code></span></dt> <dd><p>Restricts the values of <var>optname</var> to be those defined for the <samp>-o</samp> option to the <code>set</code> builtin (see <a href="the-set-builtin">The Set Builtin</a>). </p></dd> </dl> <p>If either <samp>-s</samp> or <samp>-u</samp> is used with no <var>optname</var> arguments, <code>shopt</code> shows only those options which are set or unset, respectively. </p> <p>Unless otherwise noted, the <code>shopt</code> options are disabled (off) by default. </p> <p>The return status when listing options is zero if all <var>optname</var>s are enabled, non-zero otherwise. When setting or unsetting options, the return status is zero unless an <var>optname</var> is not a valid shell option. </p> <p>The list of <code>shopt</code> options is: </p>
+<dl compact> <dt><span><code>assoc_expand_once</code></span></dt> <dd>
+<p>If set, the shell suppresses multiple evaluation of associative array subscripts during arithmetic expression evaluation, while executing builtins that can perform variable assignments, and while executing builtins that perform array dereferencing. </p> </dd> <dt><span><code>autocd</code></span></dt> <dd>
+<p>If set, a command name that is the name of a directory is executed as if it were the argument to the <code>cd</code> command. This option is only used by interactive shells. </p> </dd> <dt><span><code>cdable_vars</code></span></dt> <dd>
+<p>If this is set, an argument to the <code>cd</code> builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to. </p> </dd> <dt><span><code>cdspell</code></span></dt> <dd>
+<p>If set, minor errors in the spelling of a directory component in a <code>cd</code> command will be corrected. The errors checked for are transposed characters, a missing character, and a character too many. If a correction is found, the corrected path is printed, and the command proceeds. This option is only used by interactive shells. </p> </dd> <dt><span><code>checkhash</code></span></dt> <dd>
+<p>If this is set, Bash checks that a command found in the hash table exists before trying to execute it. If a hashed command no longer exists, a normal path search is performed. </p> </dd> <dt><span><code>checkjobs</code></span></dt> <dd>
+<p>If set, Bash lists the status of any stopped and running jobs before exiting an interactive shell. If any jobs are running, this causes the exit to be deferred until a second exit is attempted without an intervening command (see <a href="job-control">Job Control</a>). The shell always postpones exiting if any jobs are stopped. </p> </dd> <dt><span><code>checkwinsize</code></span></dt> <dd>
+<p>If set, Bash checks the window size after each external (non-builtin) command and, if necessary, updates the values of <code>LINES</code> and <code>COLUMNS</code>. This option is enabled by default. </p> </dd> <dt><span><code>cmdhist</code></span></dt> <dd>
+<p>If set, Bash attempts to save all lines of a multiple-line command in the same history entry. This allows easy re-editing of multi-line commands. This option is enabled by default, but only has an effect if command history is enabled (see <a href="bash-history-facilities">Bash History Facilities</a>). </p> </dd> <dt><span><code>compat31</code></span></dt> <dt><span><code>compat32</code></span></dt> <dt><span><code>compat40</code></span></dt> <dt><span><code>compat41</code></span></dt> <dt><span><code>compat42</code></span></dt> <dt><span><code>compat43</code></span></dt> <dt><span><code>compat44</code></span></dt> <dd>
+<p>These control aspects of the shell’s compatibility mode (see <a href="shell-compatibility-mode">Shell Compatibility Mode</a>). </p> </dd> <dt><span><code>complete_fullquote</code></span></dt> <dd>
+<p>If set, Bash quotes all shell metacharacters in filenames and directory names when performing completion. If not set, Bash removes metacharacters such as the dollar sign from the set of characters that will be quoted in completed filenames when these metacharacters appear in shell variable references in words to be completed. This means that dollar signs in variable names that expand to directories will not be quoted; however, any dollar signs appearing in filenames will not be quoted, either. This is active only when bash is using backslashes to quote completed filenames. This variable is set by default, which is the default Bash behavior in versions through 4.2. </p> </dd> <dt><span><code>direxpand</code></span></dt> <dd>
+<p>If set, Bash replaces directory names with the results of word expansion when performing filename completion. This changes the contents of the Readline editing buffer. If not set, Bash attempts to preserve what the user typed. </p> </dd> <dt><span><code>dirspell</code></span></dt> <dd>
+<p>If set, Bash attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist. </p> </dd> <dt><span><code>dotglob</code></span></dt> <dd>
+<p>If set, Bash includes filenames beginning with a ‘.’ in the results of filename expansion. The filenames ‘<samp>.</samp>’ and ‘<samp>..</samp>’ must always be matched explicitly, even if <code>dotglob</code> is set. </p> </dd> <dt><span><code>execfail</code></span></dt> <dd>
+<p>If this is set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the <code>exec</code> builtin command. An interactive shell does not exit if <code>exec</code> fails. </p> </dd> <dt><span><code>expand_aliases</code></span></dt> <dd>
+<p>If set, aliases are expanded as described below under Aliases, <a href="aliases">Aliases</a>. This option is enabled by default for interactive shells. </p> </dd> <dt><span><code>extdebug</code></span></dt> <dd>
+<p>If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell starts, identical to the <samp>--debugger</samp> option. If set after invocation, behavior intended for use by debuggers is enabled: </p> <ol> <li> The <samp>-F</samp> option to the <code>declare</code> builtin (see <a href="bash-builtins">Bash Builtin Commands</a>) displays the source file name and line number corresponding to each function name supplied as an argument. </li>
+<li> If the command run by the <code>DEBUG</code> trap returns a non-zero value, the next command is skipped and not executed. </li>
+<li> If the command run by the <code>DEBUG</code> trap returns a value of 2, and the shell is executing in a subroutine (a shell function or a shell script executed by the <code>.</code> or <code>source</code> builtins), the shell simulates a call to <code>return</code>. </li>
+<li> <code>BASH_ARGC</code> and <code>BASH_ARGV</code> are updated as described in their descriptions (see <a href="bash-variables">Bash Variables</a>). </li>
+<li> Function tracing is enabled: command substitution, shell functions, and subshells invoked with <code>( <var>command</var> )</code> inherit the <code>DEBUG</code> and <code>RETURN</code> traps. </li>
+<li> Error tracing is enabled: command substitution, shell functions, and subshells invoked with <code>( <var>command</var> )</code> inherit the <code>ERR</code> trap. </li>
+</ol> </dd> <dt><span><code>extglob</code></span></dt> <dd>
+<p>If set, the extended pattern matching features described above (see <a href="pattern-matching">Pattern Matching</a>) are enabled. </p> </dd> <dt><span><code>extquote</code></span></dt> <dd>
+<p>If set, <code>$'<var>string</var>'</code> and <code>$"<var>string</var>"</code> quoting is performed within <code>${<var>parameter</var>}</code> expansions enclosed in double quotes. This option is enabled by default. </p> </dd> <dt><span><code>failglob</code></span></dt> <dd>
+<p>If set, patterns which fail to match filenames during filename expansion result in an expansion error. </p> </dd> <dt><span><code>force_fignore</code></span></dt> <dd>
+<p>If set, the suffixes specified by the <code>FIGNORE</code> shell variable cause words to be ignored when performing word completion even if the ignored words are the only possible completions. See <a href="bash-variables">Bash Variables</a>, for a description of <code>FIGNORE</code>. This option is enabled by default. </p> </dd> <dt><span><code>globasciiranges</code></span></dt> <dd>
+<p>If set, range expressions used in pattern matching bracket expressions (see <a href="pattern-matching">Pattern Matching</a>) behave as if in the traditional C locale when performing comparisons. That is, the current locale’s collating sequence is not taken into account, so ‘<samp>b</samp>’ will not collate between ‘<samp>A</samp>’ and ‘<samp>B</samp>’, and upper-case and lower-case ASCII characters will collate together. </p> </dd> <dt><span><code>globskipdots</code></span></dt> <dd>
+<p>If set, filename expansion will never match the filenames ‘<samp>.</samp>’ and ‘<samp>..</samp>’, even if the pattern begins with a ‘<samp>.</samp>’. This option is enabled by default. </p> </dd> <dt><span><code>globstar</code></span></dt> <dd>
+<p>If set, the pattern ‘<samp>**</samp>’ used in a filename expansion context will match all files and zero or more directories and subdirectories. If the pattern is followed by a ‘<samp>/</samp>’, only directories and subdirectories match. </p> </dd> <dt><span><code>gnu_errfmt</code></span></dt> <dd>
+<p>If set, shell error messages are written in the standard <small>GNU</small> error message format. </p> </dd> <dt><span><code>histappend</code></span></dt> <dd>
+<p>If set, the history list is appended to the file named by the value of the <code>HISTFILE</code> variable when the shell exits, rather than overwriting the file. </p> </dd> <dt><span><code>histreedit</code></span></dt> <dd>
+<p>If set, and Readline is being used, a user is given the opportunity to re-edit a failed history substitution. </p> </dd> <dt><span><code>histverify</code></span></dt> <dd>
+<p>If set, and 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. </p> </dd> <dt><span><code>hostcomplete</code></span></dt> <dd>
+<p>If set, and Readline is being used, Bash will attempt to perform hostname completion when a word containing a ‘<samp>@</samp>’ is being completed (see <a href="commands-for-completion">Letting Readline Type For You</a>). This option is enabled by default. </p> </dd> <dt><span><code>huponexit</code></span></dt> <dd>
+<p>If set, Bash will send <code>SIGHUP</code> to all jobs when an interactive login shell exits (see <a href="signals">Signals</a>). </p> </dd> <dt><span><code>inherit_errexit</code></span></dt> <dd>
+<p>If set, command substitution inherits the value of the <code>errexit</code> option, instead of unsetting it in the subshell environment. This option is enabled when <small>POSIX</small> mode is enabled. </p> </dd> <dt><span><code>interactive_comments</code></span></dt> <dd>
+<p>Allow a word beginning with ‘<samp>#</samp>’ to cause that word and all remaining characters on that line to be ignored in an interactive shell. This option is enabled by default. </p> </dd> <dt><span><code>lastpipe</code></span></dt> <dd>
+<p>If set, and job control is not active, the shell runs the last command of a pipeline not executed in the background in the current shell environment. </p> </dd> <dt><span><code>lithist</code></span></dt> <dd>
+<p>If enabled, and the <code>cmdhist</code> option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible. </p> </dd> <dt><span><code>localvar_inherit</code></span></dt> <dd>
+<p>If set, local variables inherit the value and attributes of a variable of the same name that exists at a previous scope before any new value is assigned. The <code>nameref</code> attribute is not inherited. </p> </dd> <dt><span><code>localvar_unset</code></span></dt> <dd>
+<p>If set, calling <code>unset</code> on local variables in previous function scopes marks them so subsequent lookups find them unset until that function returns. This is identical to the behavior of unsetting local variables at the current function scope. </p> </dd> <dt><span><code>login_shell</code></span></dt> <dd>
+<p>The shell sets this option if it is started as a login shell (see <a href="invoking-bash">Invoking Bash</a>). The value may not be changed. </p> </dd> <dt><span><code>mailwarn</code></span></dt> <dd>
+<p>If set, and a file that Bash is checking for mail has been accessed since the last time it was checked, the message <code>"The mail in <var>mailfile</var> has been read"</code> is displayed. </p> </dd> <dt><span><code>no_empty_cmd_completion</code></span></dt> <dd>
+<p>If set, and Readline is being used, Bash will not attempt to search the <code>PATH</code> for possible completions when completion is attempted on an empty line. </p> </dd> <dt><span><code>nocaseglob</code></span></dt> <dd>
+<p>If set, Bash matches filenames in a case-insensitive fashion when performing filename expansion. </p> </dd> <dt><span><code>nocasematch</code></span></dt> <dd>
+<p>If set, Bash matches patterns in a case-insensitive fashion when performing matching while executing <code>case</code> or <code>[[</code> conditional commands (see <a href="conditional-constructs">Conditional Constructs</a>, when performing pattern substitution word expansions, or when filtering possible completions as part of programmable completion. </p> </dd> <dt><span><code>noexpand_translation</code></span></dt> <dd>
+<p>If set, Bash encloses the translated results of $"..." quoting in single quotes instead of double quotes. If the string is not translated, this has no effect. </p> </dd> <dt><span><code>nullglob</code></span></dt> <dd>
+<p>If set, Bash allows filename patterns which match no files to expand to a null string, rather than themselves. </p> </dd> <dt><span><code>patsub_replacement</code></span></dt> <dd>
+<p>If set, Bash expands occurrences of ‘<samp>&amp;</samp>’ in the replacement string of pattern substitution to the text matched by the pattern, as described above (see <a href="shell-parameter-expansion">Shell Parameter Expansion</a>). This option is enabled by default. </p> </dd> <dt><span><code>progcomp</code></span></dt> <dd>
+<p>If set, the programmable completion facilities (see <a href="programmable-completion">Programmable Completion</a>) are enabled. This option is enabled by default. </p> </dd> <dt><span><code>progcomp_alias</code></span></dt> <dd>
+<p>If set, and programmable completion is enabled, Bash treats a command name that doesn’t have any completions as a possible alias and attempts alias expansion. If it has an alias, Bash attempts programmable completion using the command word resulting from the expanded alias. </p> </dd> <dt><span><code>promptvars</code></span></dt> <dd>
+<p>If set, prompt strings undergo parameter expansion, command substitution, arithmetic expansion, and quote removal after being expanded as described below (see <a href="controlling-the-prompt">Controlling the Prompt</a>). This option is enabled by default. </p> </dd> <dt><span><code>restricted_shell</code></span></dt> <dd>
+<p>The shell sets this option if it is started in restricted mode (see <a href="the-restricted-shell">The Restricted Shell</a>). The value may not be changed. This is not reset when the startup files are executed, allowing the startup files to discover whether or not a shell is restricted. </p> </dd> <dt><span><code>shift_verbose</code></span></dt> <dd>
+<p>If this is set, the <code>shift</code> builtin prints an error message when the shift count exceeds the number of positional parameters. </p> </dd> <dt><span><code>sourcepath</code></span></dt> <dd>
+<p>If set, the <code>.</code> (<code>source</code>) builtin uses the value of <code>PATH</code> to find the directory containing the file supplied as an argument. This option is enabled by default. </p> </dd> <dt><span><code>varredir_close</code></span></dt> <dd>
+<p>If set, the shell automatically closes file descriptors assigned using the <code>{varname}</code> redirection syntax (see <a href="redirections">Redirections</a>) instead of leaving them open when the command completes. </p> </dd> <dt><span><code>xpg_echo</code></span></dt> <dd>
+<p>If set, the <code>echo</code> builtin expands backslash-escape sequences by default. </p> </dd> </dl> </dd> </dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
+ <a href="https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html</a>
+ </p>
+</div>