change `read -d' on a tty when the delimiter is not a newline to set the terminal EOL character instead of putting the terminal into character-at-a-time mode; change some calls to atoi to use strol instead

This commit is contained in:
Chet Ramey
2026-01-30 16:43:46 -05:00
parent b805bbec80
commit 468e98e574
34 changed files with 504 additions and 2161 deletions
+62 -16
View File
@@ -4,13 +4,13 @@
<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.3, 26 December 2025).
the Bash shell (version 5.3, 14 January 2026).
This is Edition 5.3, last updated 26 December 2025,
This is Edition 5.3, last updated 14 January 2026,
of The GNU Bash Reference Manual,
for Bash, Version 5.3.
Copyright © 1988-2025 Free Software Foundation, Inc.
Copyright © 1988-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -69,7 +69,6 @@ ul.toc-numbered-mark {list-style: none}
<div class="top-level-extent" id="Top">
<div class="nav-panel">
<p>
@@ -78,10 +77,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<h1 class="top" id="Bash-Features-1"><span>Bash Features<a class="copiable-link" href="#Bash-Features-1"> &para;</a></span></h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 5.3, 26 December 2025).
the Bash shell (version 5.3, 14 January 2026).
The Bash home page is <a class="url" href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 5.3, last updated 26 December 2025,
<p>This is Edition 5.3, last updated 14 January 2026,
of <cite class="cite">The GNU Bash Reference Manual</cite>,
for <code class="code">Bash</code>, Version 5.3.
</p>
@@ -1223,8 +1222,9 @@ and these are referred to as <em class="dfn">asynchronous</em> commands.
The shell does not wait for the command to finish, and the return
status is 0 (true).
When job control is not active (see <a class="pxref" href="#Job-Control">Job Control</a>),
the standard input for asynchronous commands, in the absence of any
explicit redirections, is redirected from <code class="code">/dev/null</code>.
the standard input for asynchronous commands,
in the absence of any explicit redirections involving the standard input,
is redirected from <samp class="file">/dev/null</samp>.
</p>
<p>Commands separated or terminated by
&lsquo;<samp class="samp">;</samp>&rsquo; (or equivalent <code class="code">newline</code>)
@@ -3296,7 +3296,8 @@ the parentheses make up the command; none are treated specially.
and captures its output, again with trailing newlines removed.
</p>
<p>The character <var class="var">c</var> following the open brace must be a space, tab,
newline, or &lsquo;<samp class="samp">|</samp>&rsquo;, and the close brace must be in a position
newline, &lsquo;<samp class="samp">|</samp>&rsquo;, or &lsquo;<samp class="samp">;</samp>&rsquo;;
and the close brace must be in a position
where a reserved word may appear (i.e., preceded by a command terminator
such as semicolon).
Bash allows the close brace to be joined to the remaining characters in
@@ -3315,8 +3316,17 @@ function is executing, and the <code class="code">return</code> builtin forces
however, the rest of the execution environment,
including the positional parameters, is shared with the caller.
</p>
<p>If the first character following the open brace
is a &lsquo;<samp class="samp">|</samp>&rsquo;, the construct expands to the
<p>If the first character following the open brace is a
&lsquo;<samp class="samp">;</samp>&rsquo;,
the construct behaves like the form above but
preserves any trailing newlines in the output of <var class="var">command</var>
instead of removing them.
This form is useful when the trailing newlines are significant
and should not be stripped from the command&rsquo;s output.
</p>
<p>If the first character following the open brace is a
&lsquo;<samp class="samp">|</samp>&rsquo;,
the construct expands to the
value of the <code class="code">REPLY</code> shell variable after <var class="var">command</var> executes,
without removing any trailing newlines,
and the standard output of <var class="var">command</var> remains the same as in the
@@ -4351,7 +4361,8 @@ See the description of the <code class="code">inherit_errexit</code> shell optio
in <small class="sc">POSIX</small> mode.
</p>
<p>If a command is followed by a &lsquo;<samp class="samp">&amp;</samp>&rsquo; and job control is not active, the
default standard input for the command is the empty file <samp class="file">/dev/null</samp>.
default standard input for the command is the empty file <samp class="file">/dev/null</samp>,
unless the command has an explicit redirection involving the standard input.
Otherwise, the invoked command inherits the file descriptors of the calling
shell as modified by redirections.
</p>
@@ -10186,6 +10197,9 @@ directory to a non-writable directory other than <code class="env">$HOME</code>
not allowing the restricted shell to execute shell scripts, and cleaning
the environment of variables that cause some commands to modify their
behavior (e.g., <code class="env">VISUAL</code> or <code class="env">PAGER</code>).
When setting up a restricted environment like this, it&rsquo;s important not
to install or allow symbolic links in the new current directory, since
those could be used to circumvent restrictions on writing to files.
</p>
<p>Modern systems provide more secure ways to implement a restricted environment,
such as <code class="code">jails</code>, <code class="code">zones</code>, or <code class="code">containers</code>.
@@ -10263,7 +10277,8 @@ The Bash <em class="dfn">posix mode</em> changes the Bash
behavior in these areas so that it conforms more strictly
to the standard.
</p>
<p>Starting Bash with the <samp class="option">--posix</samp> command-line option or executing
<p>Starting Bash with the <samp class="option">--posix</samp> or <samp class="option">-o posix</samp>
command-line option or executing
&lsquo;<samp class="samp">set -o posix</samp>&rsquo; while Bash is running will cause Bash to conform more
closely to the <small class="sc">POSIX</small> standard by changing the behavior to
match that specified by <small class="sc">POSIX</small> in areas where the Bash default differs.
@@ -10359,6 +10374,15 @@ This is also available with &lsquo;<samp class="samp">shopt -s checkhash</samp>&
command hash table, even if it returns it as a (last-ditch) result
from a <code class="env">$PATH</code> search.
</li><li> Normally, when job control is not enabled,
the shell implicitly redirects the standard input of
asynchronous commands from <samp class="file">/dev/null</samp>.
A redirection to the standard input in this command inhibits this
implicit redirection.
In <small class="sc">POSIX</small> mode, a redirection that redirects file descriptor 0
to itself (e.g., &lsquo;<samp class="samp">&lt;&amp;0</samp>&rsquo;) does not count as a redirection that
overrides the implicit redirection from <samp class="file">/dev/null</samp>.
</li><li> The message printed by the job control code and builtins when a job
exits with a non-zero status is &ldquo;Done(status)&rdquo;.
@@ -13512,13 +13536,34 @@ pathname expansion.
</p>
</dd>
<dt><a id="index-shell_002dexpand_002dline-_0028M_002dC_002de_0029"></a><span><code class="code">shell-expand-line (M-C-e)</code><a class="copiable-link" href="#index-shell_002dexpand_002dline-_0028M_002dC_002de_0029"> &para;</a></span></dt>
<dd><p>Expand the line by performing shell word expansions.
<dd><p>Expand the line by performing shell word expansions,
treating the line as a single shell word.
This performs alias and history expansion,
$&rsquo;<var class="var">string</var>&rsquo; and $&quot;<var class="var">string</var>&quot; quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and process substitution,
word splitting, and quote removal.
An explicit argument suppresses command and process substitution.
word splitting, and quote removal.
An explicit argument suppresses command and process substitution and
treats the line as if it were quoted as part of a here-document.
</p>
</dd>
<dt><a id="index-shell_002dexpand_002dand_002drequote_002dline-_0028_0029"></a><span><code class="code">shell-expand-and-requote-line ()</code><a class="copiable-link" href="#index-shell_002dexpand_002dand_002drequote_002dline-_0028_0029"> &para;</a></span></dt>
<dd><p>Expand the line by performing shell word expansions,
splitting the line into shell words in the same way as for
programmable completion.
This performs alias and history expansion,
$&rsquo;<var class="var">string</var>&rsquo; and $&quot;<var class="var">string</var>&quot; quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and process substitution,
word splitting, and quote removal
on each word, then quotes the resulting words if necessary to
prevent further expansion.
An explicit argument suppresses command and process substitution
and quotes each resultant word.
As usual, double-quoting a word will suppress word splitting.
This can be useful when combined with suppressing command substitution,
for instance, so the words in the command substitution aren&rsquo;t
quoted individually.
</p>
</dd>
<dt><a id="index-history_002dexpand_002dline-_0028M_002d_005e_0029"></a><span><code class="code">history-expand-line (M-^)</code><a class="copiable-link" href="#index-history_002dexpand_002dline-_0028M_002d_005e_0029"> &para;</a></span></dt>
@@ -17604,6 +17649,7 @@ Next: <a href="#Concept-Index" accesskey="n" rel="next">Concept Index</a>, Previ
<tr><td></td><td class="printindex-index-entry"><a href="#index-set_002dmark-_0028C_002d_0040_0029"><code>set-mark (C-@)</code></a></td><td class="printindex-index-section"><a href="#Miscellaneous-Commands">Miscellaneous Commands</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dbackward_002dkill_002dword-_0028_0029"><code>shell-backward-kill-word ()</code></a></td><td class="printindex-index-section"><a href="#Commands-For-Killing">Commands For Killing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dbackward_002dword-_0028M_002dC_002db_0029"><code>shell-backward-word (M-C-b)</code></a></td><td class="printindex-index-section"><a href="#Commands-For-Moving">Commands For Moving</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dexpand_002dand_002drequote_002dline-_0028_0029"><code>shell-expand-and-requote-line ()</code></a></td><td class="printindex-index-section"><a href="#Miscellaneous-Commands">Miscellaneous Commands</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dexpand_002dline-_0028M_002dC_002de_0029"><code>shell-expand-line (M-C-e)</code></a></td><td class="printindex-index-section"><a href="#Miscellaneous-Commands">Miscellaneous Commands</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dforward_002dword-_0028M_002dC_002df_0029"><code>shell-forward-word (M-C-f)</code></a></td><td class="printindex-index-section"><a href="#Commands-For-Moving">Commands For Moving</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-shell_002dkill_002dword-_0028M_002dC_002dd_0029"><code>shell-kill-word (M-C-d)</code></a></td><td class="printindex-index-section"><a href="#Commands-For-Killing">Commands For Killing</a></td></tr>