fix crash from compgen in a non-interactive shell; globstar option now works with complete -G; wait -p changes; some int->size_t changes

This commit is contained in:
Chet Ramey
2022-04-19 10:45:39 -04:00
parent 3be2a2ca9a
commit 7a8455e421
45 changed files with 7600 additions and 8195 deletions
+38 -14
View File
@@ -4,9 +4,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This text is a brief description of the features that are present in
the Bash shell (version 5.2, 5 February 2022).
the Bash shell (version 5.2, 11 April 2022).
This is Edition 5.2, last updated 5 February 2022,
This is Edition 5.2, last updated 11 April 2022,
of The GNU Bash Reference Manual,
for Bash, Version 5.2.
@@ -77,10 +77,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<span id="Bash-Features-1"></span><h1 class="top">Bash Features</h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 5.2, 5 February 2022).
the Bash shell (version 5.2, 11 April 2022).
The Bash home page is <a href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 5.2, last updated 5 February 2022,
<p>This is Edition 5.2, last updated 11 April 2022,
of <cite>The GNU Bash Reference Manual</cite>,
for <code>Bash</code>, Version 5.2.
</p>
@@ -1947,10 +1947,22 @@ return status is the exit status of the last command executed
before the <code>return</code>.
</p>
<p>Variables local to the function may be declared with the
<code>local</code> builtin. These variables are visible only to
<code>local</code> builtin (<em>local variables</em>).
Ordinarily, variables and their values
are shared between a function and its caller.
These variables are visible only to
the function and the commands it invokes. This is particularly
important when a shell function calls other functions.
</p>
<p>In the following description, the <em>current scope</em> is a currently-
executing function.
Previous scopes consist of that function&rsquo;s caller and so on,
back to the &quot;global&quot; scope, where the shell is not executing
any shell function.
Consequently, a local variable at the current local scope is a variable
declared using the <code>local</code> or <code>declare</code> builtins in the
function that is currently executing.
</p>
<p>Local variables &quot;shadow&quot; variables with the same name declared at
previous scopes. For instance, a local variable declared in a function
hides a global variable of the same name: references and assignments
@@ -2003,11 +2015,13 @@ variable is local to the current scope, <code>unset</code> will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it will remain so
(appearing as unset)
until it is reset in that scope or until the function returns.
Once the function returns, any instance of the variable at a previous
scope will become visible.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
variable with that name that had been shadowed will become visible
(see below how <code>localvar_unset</code>shell option changes this behavior).
</p>
<p>Function names and definitions may be listed with the
<samp>-f</samp> option to the <code>declare</code> (<code>typeset</code>)
@@ -2608,7 +2622,7 @@ var is set and not null
<dd><p>This is referred to as Substring Expansion.
It expands to up to <var>length</var> characters of the value of <var>parameter</var>
starting at the character specified by <var>offset</var>.
If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo;, an indexed array subscripted by
If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, an indexed array subscripted by
&lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, or an associative array name, the results differ as
described below.
If <var>length</var> is omitted, it expands to the substring of the value of
@@ -2683,8 +2697,8 @@ bc
$ echo ${array[0]: -7:-2}
bcdef
</pre>
<p>If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo;, the result is <var>length</var> positional
parameters beginning at <var>offset</var>.
<p>If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, the result is <var>length</var>
positional parameters beginning at <var>offset</var>.
A negative <var>offset</var> is taken relative to one greater than the greatest
positional parameter, so an offset of -1 evaluates to the last positional
parameter.
@@ -8646,6 +8660,9 @@ interpreted as relative to one greater than the maximum index of
<var>name</var>, so negative indices count back from the end of the
array, and an index of -1 references the last element.
</p>
<p>The &lsquo;<samp>+=</samp>&rsquo; operator will append to an array variable when assigning
using the compound assignment syntax; see <a href="#Shell-Parameters">Shell Parameters</a> above.
</p>
<p>Any element of an array may be referenced using
<code>${<var>name</var>[<var>subscript</var>]}</code>.
The braces are required to avoid
@@ -9330,6 +9347,11 @@ has been set.
If Bash receives a trapped signal while executing <code>read</code>, the trap
handler executes and <code>read</code> returns an exit status greater than 128.
</li><li> The <code>printf</code> builting uses <code>double</code> (via <code>strtod</code>) to convert
arguments corresponding to floating point conversion specifiers, instead of
<code>long double</code> if it&rsquo;s available. The &lsquo;<samp>L</samp>&rsquo; length modifier forces
<code>printf</code> to use <code>long double</code> if it&rsquo;s available.
</li><li> Bash removes an exited background process&rsquo;s status from the list of such
statuses after the <code>wait</code> builtin is used to obtain it.
@@ -10487,11 +10509,13 @@ The default is &lsquo;<samp>On</samp>&rsquo;.
</p>
</dd>
<dt id='index-enable_002dbracketed_002dpaste'><span><code>enable-bracketed-paste</code><a href='#index-enable_002dbracketed_002dpaste' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>When set to &lsquo;<samp>On</samp>&rsquo;, Readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands. The default is &lsquo;<samp>On</samp>&rsquo;.
<dd><p>When set to &lsquo;<samp>On</samp>&rsquo;, Readline configures the terminal to insert each
paste into the editing buffer as a single string of characters, instead
of treating each character as if it had been read from the keyboard.
This is called putting the terminal into <em>bracketed paste mode</em>;
it prevents Readline from executing any editing commands bound to key
sequences appearing in the pasted text.
The default is &lsquo;<samp>On</samp>&rsquo;.
</p>
</dd>
<dt id='index-enable_002dkeypad'><span><code>enable-keypad</code><a href='#index-enable_002dkeypad' class='copiable-anchor'> &para;</a></span></dt>