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
+49
View File
@@ -12619,3 +12619,52 @@ subst.c
lib/sh/shtty.c,include/shtty.h
- ttseteol, ttfd_seteol, tt_seteol: new functions to set the tty's
EOL character to something other than a newline
builtins/read.def
- read_builtin: if the `-d' option is supplied, neither `-n' nor `-N'
is supplied, and the input is a tty, use tt_seteol to set the tty
end-of-input-line delimiter to whatever the option argument is. This
means we don't put the terminal into non-canonical mode and only
issue one read(2) call. This also means that the normal canonical
input processing (erase char, erase line, etc.) takes place. This
will have to be revisited if the -d option is ever extended to
multibyte characters. The behavior of a delimiter character that
can appear as part of a multibyte character in some non-UTF-8
locale needs to be tested as well.
- read_mbchar: handle unbuffered_read == 3 (read -d on a tty)
From a suggestion by Robert Elz <kre@munnari.oz.au> back in 9/2025
1/29
----
general.c
- default_columns: use strtol and check the return values instead of
using atoi on $COLUMNS
variables.c
- sv_optind: use strtol and check the return values instead of using
atoi on $OPTIND. This means that setting OPTIND to a non-numeric
value is a no-op
- sv_opterr: use strtol and check the return values instead of using
atoi on $OPTERR. This means that setting OPTERR to a non-numeric
value sets sh_opterr to the default (1)
- sv_childmax: use strtol instead of atoi to convert $MAXCHILD. This
means a conversion error is the same as 0
eval.c
- read_command: use strtol and check the return values instead of using
atoi on $TMOUT. This means that setting TMOUT to a non-numeric
value is a no-op
builtins/fc.def
- fc_gethnum: use strtol instead of using atoi on the numeric argument
1/30
----
array.c,array2.c
- array_subslice: return a string with the elements of an array between
specified start and end indices, inclusive. A variant of
array_subrange, but does not return a specified number of elements.
Not used yet, but could be used for another array parameter
expansion, like ksh93's array[s..e]
+43 -1
View File
@@ -9,7 +9,7 @@
* chet@ins.cwru.edu
*/
/* Copyright (C) 1997-2023 Free Software Foundation, Inc.
/* Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -415,6 +415,48 @@ array_subrange (ARRAY *a, arrayind_t start, arrayind_t nelem, int starsub, int q
return t;
}
char *
array_subslice (ARRAY *a, arrayind_t start, arrayind_t end, int starsub, int quoted, int pflags)
{
ARRAY *a2;
ARRAY_ELEMENT *h, *p;
arrayind_t i;
char *t;
WORD_LIST *wl;
p = a ? array_head (a) : 0;
if (p == 0 || array_empty (a) || start > array_max_index(a))
return ((char *)NULL);
/*
* Find element with index START. If START corresponds to an unset
* element (arrays can be sparse), use the first element whose index
* is >= START. If START is < 0, we count START indices back from
* the end of A (not elements, even with sparse arrays -- START is an
* index).
*/
for (p = element_forw(p); p != array_head(a) && start > element_index(p); p = element_forw(p))
;
if (p == a->head)
return ((char *)NULL);
/* Starting at P, find END. */
for (i = element_index(p), h = p; p != a->head && end > element_index(p); p = element_forw(p))
;
a2 = array_slice(a, h, p);
wl = array_to_word_list(a2);
array_dispose(a2);
if (wl == 0)
return (char *)NULL;
t = string_list_pos_params(starsub ? '*' : '@', wl, quoted, pflags); /* XXX */
dispose_words(wl);
return t;
}
char *
array_patsub (ARRAY *a, char *pat, char *rep, int mflags)
{
+1
View File
@@ -87,6 +87,7 @@ extern ARRAY *array_dequote_escapes (ARRAY *);
extern ARRAY *array_remove_quoted_nulls (ARRAY *);
extern char *array_subrange (ARRAY *, arrayind_t, arrayind_t, int, int, int);
extern char *array_subslice (ARRAY *, arrayind_t, arrayind_t, int, int, int);
extern char *array_patsub (ARRAY *, char *, char *, int);
extern char *array_modcase (ARRAY *, char *, int, int);
+50 -1
View File
@@ -9,7 +9,7 @@
* chet@ins.cwru.edu
*/
/* Copyright (C) 1997-2023 Free Software Foundation, Inc.
/* Copyright (C) 1997-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -47,6 +47,13 @@
#define ARRAY_MAX_DOUBLE 16777216
#ifndef amin
# define amin(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef amax
# define amax(a, b) ((a) > (b) ? (a) : (b))
#endif
static ARRAY_ELEMENT **array_copy_elements (ARRAY *);
static char *array_to_string_internal (ARRAY *, arrayind_t, arrayind_t, char *, int);
@@ -535,6 +542,48 @@ array_subrange (ARRAY *a, arrayind_t start, arrayind_t nelem, int starsub, int q
return t;
}
char *
array_subslice (ARRAY *a, arrayind_t start, arrayind_t end, int starsub, int quoted, int pflags)
{
ARRAY *a2;
arrayind_t s, e;
int i;
char *t;
WORD_LIST *wl;
if (array_empty (a) || start > array_max_index(a))
return ((char *)NULL);
/*
* Find element with index START. If START corresponds to an unset
* element (arrays can be sparse), use the first element whose index
* is >= START. If START is < 0, we count START indices back from
* the end of A (not elements, even with sparse arrays -- START is an
* index).
*/
for (s = start; s <= a->max_index && a->elements[s] == 0; s++)
;
if (s > a->max_index)
return ((char *)NULL);
/* Find the element with index END. If END corresponds to an unset
element, use the first element whose index is <= END. If END is
greater than max_index, use max_index*/
for (e = amin(end, a->max_index); e >= 0 && a->elements[e] == 0; e--)
;
a2 = array_slice(a, s, e);
wl = array_to_word_list(a2);
array_dispose(a2);
if (wl == 0)
return (char *)NULL;
t = string_list_pos_params(starsub ? '*' : '@', wl, quoted, pflags); /* XXX */
dispose_words(wl);
return t;
}
char *
array_patsub (ARRAY *a, char *pat, char *rep, int mflags)
{
+1 -1
View File
@@ -641,7 +641,7 @@ fc_gethnum (char *command, HIST_ENTRY **hlist, int mode)
if (s && DIGIT(*s))
{
n = atoi (s);
n = (int)strtol (s, (char **)NULL, 10);
n *= sign;
/* We want to return something that is an offset to HISTORY_BASE. */
+31 -15
View File
@@ -1,7 +1,7 @@
This file is read.def, from which is created read.c.
It implements the builtin "read" in Bash.
Copyright (C) 1987-2025 Free Software Foundation, Inc.
Copyright (C) 1987-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -249,7 +249,7 @@ read_builtin (WORD_LIST *list)
{
char *varname;
int nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2, nflag;
size_t size;
size_t input_string_size;
volatile int i;
int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
int edit, use_bash_completion;
@@ -279,7 +279,7 @@ read_builtin (WORD_LIST *list)
FILE *save_instream;
#endif
USE_VAR(size);
USE_VAR(input_string_size);
USE_VAR(i);
USE_VAR(pass_next);
USE_VAR(print_ps2);
@@ -421,6 +421,8 @@ read_builtin (WORD_LIST *list)
{
int ct; /* change terminal settings */
/* XXX - revisit this now that bash doesn't change terminal settings if
the delimiter is not a newline. */
ct = (nflag || delim != '\n') && isatty (fd);
return (check_read_input (fd, ct) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
@@ -460,7 +462,7 @@ read_builtin (WORD_LIST *list)
for (skip_ctlesc = skip_ctlnul = 0, e = ifs_chars; *e; e++)
skip_ctlesc |= *e == CTLESC, skip_ctlnul |= *e == CTLNUL;
input_string = (char *)xmalloc (size = 112); /* XXX was 128 */
input_string = (char *)xmalloc (input_string_size = 496); /* XXX was 128 */
input_string[0] = '\0';
pass_next = 0; /* Non-zero signifies last char was backslash. */
@@ -616,13 +618,24 @@ read_builtin (WORD_LIST *list)
#endif
if (input_is_tty)
{
int rc;
/* ttsave() */
termsave.fd = fd;
ttgetattr (fd, &ttattrs);
termsave.attrs = ttattrs;
ttset = ttattrs;
if ((silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset)) < 0)
ttset = ttattrs;
if (nchars > 0)
rc = silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset);
else /* delim != '\n' */
{
rc = silent ? tt_setnoecho (&ttset) : 0;
if (rc >= 0)
rc = ttfd_seteol (fd, &ttset, delim);
}
if (rc < 0)
sh_ttyerror (1);
tty_modified = 1;
add_unwind_protect (uw_ttyrestore, &termsave);
@@ -690,12 +703,11 @@ read_builtin (WORD_LIST *list)
/* These only matter if edit == 0 */
if ((nchars > 0) && (input_is_tty == 0) && ignore_delim) /* read -N */
unbuffered_read = 2;
#if 0
else if ((nchars > 0) || (delim != '\n') || input_is_pipe)
#else
else if (((nchars > 0 || delim != '\n') && input_is_tty) || input_is_pipe)
else if ((nchars > 0 && input_is_tty) || input_is_pipe) /* read -n */
unbuffered_read = 1;
#endif
else if (delim != '\n' && input_is_tty) /* read -d */
unbuffered_read = 3;
if (prompt && edit == 0)
{
fprintf (stderr, "%s", prompt);
@@ -759,9 +771,11 @@ read_builtin (WORD_LIST *list)
if (tmsec > 0 || tmusec > 0)
sigprocmask (SIG_SETMASK, &chldset, &prevset);
#endif
if (unbuffered_read == 2)
if (unbuffered_read == 2) /* read -N */
retval = posixly_correct ? zreadintr (fd, &c, 1) : zreadn (fd, &c, nchars - nr);
else if (unbuffered_read)
else if (unbuffered_read == 3) /* read -d on a tty */
retval = posixly_correct ? zreadcintr (fd, &c) : zreadc (fd, &c);
else if (unbuffered_read) /* read -n or input_is_pipe */
retval = posixly_correct ? zreadintr (fd, &c, 1) : zread (fd, &c, 1);
else
retval = posixly_correct ? zreadcintr (fd, &c) : zreadc (fd, &c);
@@ -811,10 +825,10 @@ read_builtin (WORD_LIST *list)
check_read_timeout ();
/* XXX -- use i + mb_cur_max (at least 4) for multibyte/read_mbchar */
if (i + (mb_cur_max > 4 ? mb_cur_max : 4) >= size)
if (i + (mb_cur_max > 4 ? mb_cur_max : 4) >= input_string_size)
{
char *x;
x = (char *)xrealloc (input_string, size += 128);
x = (char *)xrealloc (input_string, input_string_size += 512);
#if 0
/* This is, in theory, undefined behavior, since input_string may
@@ -1213,6 +1227,8 @@ read_mbchar (int fd, char *string, int ind, int ch, int delim, int unbuffered)
/* We don't want to be interrupted during a multibyte char read */
if (unbuffered == 2)
r = zreadn (fd, &c, 1);
else if (unbuffered == 3)
r = zreadc (fd, &c);
else if (unbuffered)
r = zread (fd, &c, 1);
else
+57 -19
View File
@@ -1,5 +1,5 @@
<!-- Creator : groff version 1.23.0 -->
<!-- CreationDate: Wed Dec 31 13:23:39 2025 -->
<!-- CreationDate: Thu Jan 29 13:25:46 2026 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
@@ -133,7 +133,7 @@ Bourne-Again SHell</p>
<p style="margin-left:9%; margin-top: 1em">Bash is
Copyright (C) 1989-2025 by the Free Software Foundation,
Copyright (C) 1989-2026 by the Free Software Foundation,
Inc.</p>
<h2>DESCRIPTION
@@ -881,11 +881,17 @@ a semicolon to delimit commands.</p>
<p style="margin-left:9%; margin-top: 1em">If a command is
terminated by the control operator <b>&amp;</b>, the shell
executes the command in the <i>background</i> in a subshell.
The shell does not wait for the command to finish, and the
return status is 0. These are referred to as
<i>asynchronous</i> commands. Commands separated or
terminated by <b>;</b> (or an equivalent
executes the command asynchronously in a subshell. This is
known as executing a command in the <i>background</i>, and
these are referred to as <i>asynchronous</i> commands. The
shell does not wait for the command to finish, and the
return status is 0. When job control is not active, the
standard input for asynchronous commands, in the absence of
any explicit redirections involving the standard input, is
redirected from <i>/dev/null</i>.</p>
<p style="margin-left:9%; margin-top: 1em">Commands
separated or terminated by <b>;</b> (or an equivalent
<b>&lt;newline&gt;</b>) are executed sequentially; the shell
waits for each command to terminate in turn.</p>
@@ -4607,12 +4613,13 @@ removed.</p>
<p style="margin-left:9%; margin-top: 1em">The character
<i>c</i> following the open brace must be a space, tab,
newline, or <b>|</b>, 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). <b>Bash</b> allows
the close brace to be joined to the remaining characters in
the word without being followed by a shell metacharacter as
a reserved word would usually require.</p>
newline, &ldquo;|&rdquo;, or &ldquo;;&rdquo;; 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).
<b>Bash</b> allows the close brace to be joined to the
remaining characters in the word without being followed by a
shell metacharacter as a reserved word would usually
require.</p>
<p style="margin-left:9%; margin-top: 1em">Any side effects
of <i>command</i> take effect immediately in the current
@@ -4629,7 +4636,15 @@ execution environment, including the positional parameters,
is shared with the caller.</p>
<p style="margin-left:9%; margin-top: 1em">If the first
character following the open brace is a <b>|</b>, the
character following the open brace is a &ldquo;;&rdquo;, the
construct behaves like the form above but preserves any
trailing newlines in the output of <i>command</i> 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 style="margin-left:9%; margin-top: 1em">If the first
character following the open brace is a &ldquo;|&rdquo;, the
construct expands to the value of the <b>REPLY</b> shell
variable after <i>command</i> executes, without removing any
trailing newlines, and the standard output of <i>command</i>
@@ -6593,9 +6608,10 @@ in posix mode.</p>
<p style="margin-left:9%; margin-top: 1em">If a command is
followed by a <b>&amp;</b> and job control is not active,
the default standard input for the command is the empty file
<i>/dev/null</i>. Otherwise, the invoked command inherits
the file descriptors of the calling shell as modified by
redirections.</p>
<i>/dev/null</i>, 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>
<h2>ENVIRONMENT
<a name="ENVIRONMENT"></a>
@@ -8872,8 +8888,9 @@ facilities to extract the last word, as if the
(M&minus;C&minus;e)</b></p>
<p style="margin-left:18%;">Expand the line by performing
shell word expansions. This performs alias and history
expansion, <b>$</b>'<i>string</i>' and
shell word expansions, treating the line as a single shell
word. This performs alias and history expansion,
<b>$</b>'<i>string</i>' and
<b>$</b>&quot;<i>string</i>&quot; quoting, tilde expansion,
parameter and variable expansion, arithmetic expansion,
command and process substitution, word splitting, and quote
@@ -8882,6 +8899,27 @@ substitution. See <b><small>HISTORY EXPANSION</small></b>
below for a description of history expansion.</p>
<p style="margin-left:9%;"><b>shell&minus;expand&minus;and&minus;requote&minus;line
()</b></p>
<p style="margin-left:18%;">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,
<b>$</b>'<i>string</i>' and
<b>$</b>&quot;<i>string</i>&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>
<p style="margin-left:9%;"><b>history&minus;expand&minus;line
(M&minus;^)</b></p>
+60 -57
View File
@@ -7662,7 +7662,10 @@ that allow shell escapes are particularly vulnerable), changing the
current directory to a non-writable directory other than $HOME after
login, 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., VISUAL or PAGER).
their behavior (e.g., VISUAL or PAGER). When setting up a
restricted environment like this, it'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.
Modern systems provide more secure ways to implement a restricted
environment, such as jails, zones, or containers.
@@ -13801,62 +13804,62 @@ Node: The Directory Stack330317
Node: Directory Stack Builtins331114
Node: Controlling the Prompt335559
Node: The Restricted Shell338443
Node: Bash POSIX Mode341325
Node: Shell Compatibility Mode360741
Node: Job Control369748
Node: Job Control Basics370205
Node: Job Control Builtins376573
Node: Job Control Variables383361
Node: Command Line Editing384592
Node: Introduction and Notation386295
Node: Readline Interaction388647
Node: Readline Bare Essentials389835
Node: Readline Movement Commands391643
Node: Readline Killing Commands392639
Node: Readline Arguments394662
Node: Searching395752
Node: Readline Init File397995
Node: Readline Init File Syntax399298
Node: Conditional Init Constructs426249
Node: Sample Init File430634
Node: Bindable Readline Commands433754
Node: Commands For Moving435292
Node: Commands For History437756
Node: Commands For Text443147
Node: Commands For Killing447272
Node: Numeric Arguments450060
Node: Commands For Completion451212
Node: Keyboard Macros456908
Node: Miscellaneous Commands457609
Node: Readline vi Mode465152
Node: Programmable Completion466129
Node: Programmable Completion Builtins475865
Node: A Programmable Completion Example487602
Node: Using History Interactively492947
Node: Bash History Facilities493628
Node: Bash History Builtins497363
Node: History Interaction504958
Node: Event Designators509908
Node: Word Designators511486
Node: Modifiers513878
Node: Installing Bash515815
Node: Basic Installation516931
Node: Compilers and Options520807
Node: Compiling For Multiple Architectures521557
Node: Installation Names523310
Node: Specifying the System Type525544
Node: Sharing Defaults526290
Node: Operation Controls527004
Node: Optional Features528023
Node: Reporting Bugs540746
Node: Major Differences From The Bourne Shell542103
Node: GNU Free Documentation License563530
Node: Indexes588707
Node: Builtin Index589158
Node: Reserved Word Index596256
Node: Variable Index598701
Node: Function Index616114
Node: Concept Index630247
Node: Bash POSIX Mode341536
Node: Shell Compatibility Mode360952
Node: Job Control369959
Node: Job Control Basics370416
Node: Job Control Builtins376784
Node: Job Control Variables383572
Node: Command Line Editing384803
Node: Introduction and Notation386506
Node: Readline Interaction388858
Node: Readline Bare Essentials390046
Node: Readline Movement Commands391854
Node: Readline Killing Commands392850
Node: Readline Arguments394873
Node: Searching395963
Node: Readline Init File398206
Node: Readline Init File Syntax399509
Node: Conditional Init Constructs426460
Node: Sample Init File430845
Node: Bindable Readline Commands433965
Node: Commands For Moving435503
Node: Commands For History437967
Node: Commands For Text443358
Node: Commands For Killing447483
Node: Numeric Arguments450271
Node: Commands For Completion451423
Node: Keyboard Macros457119
Node: Miscellaneous Commands457820
Node: Readline vi Mode465363
Node: Programmable Completion466340
Node: Programmable Completion Builtins476076
Node: A Programmable Completion Example487813
Node: Using History Interactively493158
Node: Bash History Facilities493839
Node: Bash History Builtins497574
Node: History Interaction505169
Node: Event Designators510119
Node: Word Designators511697
Node: Modifiers514089
Node: Installing Bash516026
Node: Basic Installation517142
Node: Compilers and Options521018
Node: Compiling For Multiple Architectures521768
Node: Installation Names523521
Node: Specifying the System Type525755
Node: Sharing Defaults526501
Node: Operation Controls527215
Node: Optional Features528234
Node: Reporting Bugs540957
Node: Major Differences From The Bourne Shell542314
Node: GNU Free Documentation License563741
Node: Indexes588918
Node: Builtin Index589369
Node: Reserved Word Index596467
Node: Variable Index598912
Node: Function Index616325
Node: Concept Index630458

End Tag Table
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -60,9 +60,9 @@
@xrdef{Compound Commands-pg}{11}
@xrdef{Looping Constructs-title}{Looping Constructs}
@xrdef{Looping Constructs-snt}{Section@tie 3.2.5.1}
@xrdef{Looping Constructs-pg}{12}
@xrdef{Conditional Constructs-title}{Conditional Constructs}
@xrdef{Conditional Constructs-snt}{Section@tie 3.2.5.2}
@xrdef{Looping Constructs-pg}{12}
@xrdef{Conditional Constructs-pg}{13}
@xrdef{Command Grouping-title}{Grouping Commands}
@xrdef{Command Grouping-snt}{Section@tie 3.2.5.3}
@@ -102,9 +102,9 @@
@xrdef{Command Substitution-pg}{36}
@xrdef{Arithmetic Expansion-title}{Arithmetic Expansion}
@xrdef{Arithmetic Expansion-snt}{Section@tie 3.5.5}
@xrdef{Arithmetic Expansion-pg}{37}
@xrdef{Process Substitution-title}{Process Substitution}
@xrdef{Process Substitution-snt}{Section@tie 3.5.6}
@xrdef{Arithmetic Expansion-pg}{37}
@xrdef{Word Splitting-title}{Word Splitting}
@xrdef{Word Splitting-snt}{Section@tie 3.5.7}
@xrdef{Process Substitution-pg}{38}
@@ -132,7 +132,7 @@
@xrdef{Command Execution Environment-title}{Command Execution Environment}
@xrdef{Command Execution Environment-snt}{Section@tie 3.7.3}
@xrdef{Command Search and Execution-pg}{46}
@xrdef{Command Execution Environment-pg}{46}
@xrdef{Command Execution Environment-pg}{47}
@xrdef{Environment-title}{Environment}
@xrdef{Environment-snt}{Section@tie 3.7.4}
@xrdef{Exit Status-title}{Exit Status}
@@ -225,7 +225,7 @@
@xrdef{Bash POSIX Mode-pg}{116}
@xrdef{Shell Compatibility Mode-title}{Shell Compatibility Mode}
@xrdef{Shell Compatibility Mode-snt}{Section@tie 6.12}
@xrdef{Shell Compatibility Mode-pg}{121}
@xrdef{Shell Compatibility Mode-pg}{122}
@xrdef{Job Control-title}{Job Control}
@xrdef{Job Control-snt}{Chapter@tie 7}
@xrdef{Job Control Basics-title}{Job Control Basics}
+1 -1
View File
@@ -55,7 +55,7 @@
\entry{disown}{128}{\code {disown}}
\entry{suspend}{128}{\code {suspend}}
\entry{compgen}{161}{\code {compgen}}
\entry{complete}{161}{\code {complete}}
\entry{complete}{162}{\code {complete}}
\entry{compopt}{165}{\code {compopt}}
\entry{fc}{169}{\code {fc}}
\entry{history}{170}{\code {history}}
+1 -1
View File
@@ -16,7 +16,7 @@
\entry{\code {cd}}{53}
\entry{\code {command}}{63}
\entry{\code {compgen}}{161}
\entry{\code {complete}}{161}
\entry{\code {complete}}{162}
\entry{\code {compopt}}{165}
\entry{\code {continue}}{54}
\initial {D}
+3 -3
View File
@@ -70,7 +70,7 @@
\entry{command expansion}{45}{command expansion}
\entry{command execution}{46}{command execution}
\entry{command search}{46}{command search}
\entry{execution environment}{46}{execution environment}
\entry{execution environment}{47}{execution environment}
\entry{environment}{48}{environment}
\entry{exit status}{48}{exit status}
\entry{signal handling}{49}{signal handling}
@@ -99,8 +99,8 @@
\entry{restricted shell}{115}{restricted shell}
\entry{POSIX description}{116}{POSIX description}
\entry{POSIX Mode}{117}{POSIX Mode}
\entry{Compatibility Level}{121}{Compatibility Level}
\entry{Compatibility Mode}{121}{Compatibility Mode}
\entry{Compatibility Level}{122}{Compatibility Level}
\entry{Compatibility Mode}{122}{Compatibility Mode}
\entry{job control}{125}{job control}
\entry{foreground}{125}{foreground}
\entry{background}{125}{background}
+3 -3
View File
@@ -31,8 +31,8 @@
\entry{commands, shell}{9}
\entry{commands, simple}{10}
\entry{comments, shell}{9}
\entry{Compatibility Level}{121}
\entry{Compatibility Mode}{121}
\entry{Compatibility Level}{122}
\entry{Compatibility Mode}{122}
\entry{completion builtins}{161}
\entry{conditional arithmetic operator}{108}
\entry{configuration}{175}
@@ -46,7 +46,7 @@
\entry{environment}{48}
\entry{evaluation, arithmetic}{107}
\entry{event designators}{172}
\entry{execution environment}{46}
\entry{execution environment}{47}
\entry{exit status}{3, 48}
\entry{expansion}{25}
\entry{expansion, arithmetic}{37}
+2 -1
View File
@@ -107,7 +107,8 @@
\entry{glob-expand-word (C-x *)}{157}{\code {glob-expand-word (C-x *)}}
\entry{glob-list-expansions (C-x g)}{157}{\code {glob-list-expansions (C-x g)}}
\entry{shell-expand-line (M-C-e)}{157}{\code {shell-expand-line (M-C-e)}}
\entry{history-expand-line (M-^)}{157}{\code {history-expand-line (M-^)}}
\entry{shell-expand-and-requote-line ()}{157}{\code {shell-expand-and-requote-line ()}}
\entry{history-expand-line (M-^)}{158}{\code {history-expand-line (M-^)}}
\entry{magic-space ()}{158}{\code {magic-space ()}}
\entry{alias-expand-line ()}{158}{\code {alias-expand-line ()}}
\entry{history-and-alias-expand-line ()}{158}{\code {history-and-alias-expand-line ()}}
+2 -1
View File
@@ -62,7 +62,7 @@
\entry{\code {glob-list-expansions (C-x g)}}{157}
\initial {H}
\entry{\code {history-and-alias-expand-line ()}}{158}
\entry{\code {history-expand-line (M-^)}}{157}
\entry{\code {history-expand-line (M-^)}}{158}
\entry{\code {history-search-backward ()}}{149}
\entry{\code {history-search-forward ()}}{149}
\entry{\code {history-substring-search-backward ()}}{149}
@@ -111,6 +111,7 @@
\entry{\code {set-mark (C-@)}}{156}
\entry{\code {shell-backward-kill-word ()}}{152}
\entry{\code {shell-backward-word (M-C-b)}}{147}
\entry{\code {shell-expand-and-requote-line ()}}{157}
\entry{\code {shell-expand-line (M-C-e)}}{157}
\entry{\code {shell-forward-word (M-C-f)}}{147}
\entry{\code {shell-kill-word (M-C-d)}}{152}
+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>
+60 -57
View File
@@ -7663,7 +7663,10 @@ that allow shell escapes are particularly vulnerable), changing the
current directory to a non-writable directory other than $HOME after
login, 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., VISUAL or PAGER).
their behavior (e.g., VISUAL or PAGER). When setting up a
restricted environment like this, it'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.
Modern systems provide more secure ways to implement a restricted
environment, such as jails, zones, or containers.
@@ -13802,62 +13805,62 @@ Node: The Directory Stack330536
Node: Directory Stack Builtins331336
Node: Controlling the Prompt335784
Node: The Restricted Shell338671
Node: Bash POSIX Mode341556
Node: Shell Compatibility Mode360975
Node: Job Control369985
Node: Job Control Basics370445
Node: Job Control Builtins376816
Node: Job Control Variables383607
Node: Command Line Editing384841
Node: Introduction and Notation386547
Node: Readline Interaction388902
Node: Readline Bare Essentials390093
Node: Readline Movement Commands391904
Node: Readline Killing Commands392903
Node: Readline Arguments394929
Node: Searching396022
Node: Readline Init File398268
Node: Readline Init File Syntax399574
Node: Conditional Init Constructs426528
Node: Sample Init File430916
Node: Bindable Readline Commands434039
Node: Commands For Moving435580
Node: Commands For History438047
Node: Commands For Text443441
Node: Commands For Killing447569
Node: Numeric Arguments450360
Node: Commands For Completion451515
Node: Keyboard Macros457214
Node: Miscellaneous Commands457918
Node: Readline vi Mode465464
Node: Programmable Completion466444
Node: Programmable Completion Builtins476183
Node: A Programmable Completion Example487923
Node: Using History Interactively493271
Node: Bash History Facilities493955
Node: Bash History Builtins497693
Node: History Interaction505291
Node: Event Designators510244
Node: Word Designators511825
Node: Modifiers514220
Node: Installing Bash516160
Node: Basic Installation517279
Node: Compilers and Options521158
Node: Compiling For Multiple Architectures521911
Node: Installation Names523667
Node: Specifying the System Type525904
Node: Sharing Defaults526653
Node: Operation Controls527370
Node: Optional Features528392
Node: Reporting Bugs541118
Node: Major Differences From The Bourne Shell542478
Node: GNU Free Documentation License563908
Node: Indexes589088
Node: Builtin Index589542
Node: Reserved Word Index596643
Node: Variable Index599091
Node: Function Index616507
Node: Concept Index630643
Node: Bash POSIX Mode341767
Node: Shell Compatibility Mode361186
Node: Job Control370196
Node: Job Control Basics370656
Node: Job Control Builtins377027
Node: Job Control Variables383818
Node: Command Line Editing385052
Node: Introduction and Notation386758
Node: Readline Interaction389113
Node: Readline Bare Essentials390304
Node: Readline Movement Commands392115
Node: Readline Killing Commands393114
Node: Readline Arguments395140
Node: Searching396233
Node: Readline Init File398479
Node: Readline Init File Syntax399785
Node: Conditional Init Constructs426739
Node: Sample Init File431127
Node: Bindable Readline Commands434250
Node: Commands For Moving435791
Node: Commands For History438258
Node: Commands For Text443652
Node: Commands For Killing447780
Node: Numeric Arguments450571
Node: Commands For Completion451726
Node: Keyboard Macros457425
Node: Miscellaneous Commands458129
Node: Readline vi Mode465675
Node: Programmable Completion466655
Node: Programmable Completion Builtins476394
Node: A Programmable Completion Example488134
Node: Using History Interactively493482
Node: Bash History Facilities494166
Node: Bash History Builtins497904
Node: History Interaction505502
Node: Event Designators510455
Node: Word Designators512036
Node: Modifiers514431
Node: Installing Bash516371
Node: Basic Installation517490
Node: Compilers and Options521369
Node: Compiling For Multiple Architectures522122
Node: Installation Names523878
Node: Specifying the System Type526115
Node: Sharing Defaults526864
Node: Operation Controls527581
Node: Optional Features528603
Node: Reporting Bugs541329
Node: Major Differences From The Bourne Shell542689
Node: GNU Free Documentation License564119
Node: Indexes589299
Node: Builtin Index589753
Node: Reserved Word Index596854
Node: Variable Index599302
Node: Function Index616718
Node: Concept Index630854

End Tag Table
+21 -21
View File
@@ -1,12 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2025/MacPorts 2025.74524_1) (preloaded format=pdfetex 2025.9.16) 31 DEC 2025 13:23
This is pdfTeX, Version 3.141592653-2.6-1.40.27 (TeX Live 2025/MacPorts 2025.74524_1) (preloaded format=pdfetex 2025.9.16) 29 JAN 2026 13:25
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input /usr/local/src/bash/bash-20251226/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20251226/doc/bashref.texi
(/usr/local/src/bash/bash-20251226/doc/bashref.texi
(/usr/local/src/bash/bash-20251226/doc/texinfo.tex
**\input /usr/local/src/bash/bash-20260123/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20260123/doc/bashref.texi
(/usr/local/src/bash/bash-20260123/doc/bashref.texi
(/usr/local/src/bash/bash-20260123/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -162,15 +162,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20251226/doc/version.texi) [1{/opt/local/var/db/texmf
(/usr/local/src/bash/bash-20260123/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20251226/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20251226/doc/bashref.toc)
(/usr/local/build/bash/bash-20251226/doc/bashref.toc) Chapter 1
(/usr/local/build/bash/bash-20260123/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20260123/doc/bashref.toc)
(/usr/local/build/bash/bash-20260123/doc/bashref.toc) Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20251226/doc/bashref.aux)
(/usr/local/build/bash/bash-20260123/doc/bashref.aux)
\openout1 = `bashref.aux'.
[1] Chapter 2 [2]
@@ -232,7 +232,7 @@ exlive/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [21] [22] [23] [24]
[52]
[53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67]
[68] [69] [70] [71] [72] [73]
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5952--5952
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5964--5964
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -245,7 +245,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5952--5952
.etc.
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5953--5953
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5965--5965
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -265,7 +265,7 @@ Chapter 7 [124] [125] [126] [127] [128]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20251226/lib/readline/doc/rluser.texi Chapter 8
(/usr/local/src/bash/bash-20260123/lib/readline/doc/rluser.texi Chapter 8
[129] [130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140]
Underfull \hbox (badness 7540) in paragraph at lines 969--975
[]@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func
@@ -314,10 +314,10 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20251226/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20260123/lib/readline/doc/hsuser.texi Chapter 9
[167] [168] [169] [170] [171] [172] [173]) Chapter 10 [174] [175] [176]
[177] [178]
Underfull \hbox (badness 10000) in paragraph at lines 10767--10776
Underfull \hbox (badness 10000) in paragraph at lines 10793--10802
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
entation[]@textrm '[],
@@ -330,7 +330,7 @@ entation[]@textrm '[],
.etc.
Underfull \hbox (badness 10000) in paragraph at lines 10767--10776
Underfull \hbox (badness 10000) in paragraph at lines 10793--10802
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
@@ -347,13 +347,13 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20251226/doc/fdl.texi [192] [193] [194] [195]
(/usr/local/src/bash/bash-20260123/doc/fdl.texi [192] [193] [194] [195]
[196] [197] [198]) Appendix D [199] [200] [201] [202] [203] [204] [205]
[206] [207] [208] )
Here is how much of TeX's memory you used:
4116 strings out of 495820
47662 string characters out of 6170887
145127 words of memory out of 5000000
145125 words of memory out of 5000000
5053 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
701 hyphenation exceptions out of 8191
@@ -374,10 +374,10 @@ fonts/type1/public/amsfonts/cm/cmti10.pfb></opt/local/share/texmf-texlive/fonts
lic/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm
-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/type1/public/cm-super
/sfrm1440.pfb>
Output written on bashref.pdf (214 pages, 811602 bytes).
Output written on bashref.pdf (214 pages, 813195 bytes).
PDF statistics:
2947 PDF objects out of 2984 (max. 8388607)
2685 compressed objects within 27 object streams
2948 PDF objects out of 2984 (max. 8388607)
2686 compressed objects within 27 object streams
342 named destinations out of 1000 (max. 500000)
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
BIN
View File
Binary file not shown.
+3
View File
@@ -9188,6 +9188,9 @@ directory to a non-writable directory other than @env{$HOME} after login,
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., @env{VISUAL} or @env{PAGER}).
When setting up a restricted environment like this, it'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.
Modern systems provide more secure ways to implement a restricted environment,
such as @code{jails}, @code{zones}, or @code{containers}.
+4 -4
View File
@@ -43,16 +43,16 @@
@numsubsecentry{Redirecting Output}{3.6.2}{}{43}
@numsubsecentry{Appending Redirected Output}{3.6.3}{}{43}
@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{43}
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{43}
@numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{44}
@numsubsecentry{Here Documents}{3.6.6}{}{44}
@numsubsecentry{Here Strings}{3.6.7}{}{44}
@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{44}
@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{45}
@numsubsecentry{Moving File Descriptors}{3.6.9}{}{45}
@numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{45}
@numsecentry{Executing Commands}{3.7}{Executing Commands}{45}
@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{45}
@numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{46}
@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{46}
@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{47}
@numsubsecentry{Environment}{3.7.4}{Environment}{48}
@numsubsecentry{Exit Status}{3.7.5}{Exit Status}{48}
@numsubsecentry{Signals}{3.7.6}{Signals}{49}
@@ -85,7 +85,7 @@
@numsecentry{Bash and POSIX}{6.11}{Bash POSIX Mode}{116}
@numsubsecentry{What is POSIX?}{6.11.1}{}{116}
@numsubsecentry{Bash POSIX Mode}{6.11.2}{}{117}
@numsecentry{Shell Compatibility Mode}{6.12}{Shell Compatibility Mode}{121}
@numsecentry{Shell Compatibility Mode}{6.12}{Shell Compatibility Mode}{122}
@numchapentry{Job Control}{7}{Job Control}{125}
@numsecentry{Job Control Basics}{7.1}{Job Control Basics}{125}
@numsecentry{Job Control Builtins}{7.2}{Job Control Builtins}{126}
BIN
View File
Binary file not shown.
+5 -3
View File
@@ -1,6 +1,6 @@
/* eval.c -- reading and evaluating commands. */
/* Copyright (C) 1996-2025 Free Software Foundation, Inc.
/* Copyright (C) 1996-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -385,6 +385,7 @@ read_command (void)
SHELL_VAR *tmout_var;
int tmout_len, result;
SigHandler *old_alrm;
char *t, *e;
set_current_prompt_level (1);
global_command = (COMMAND *)NULL;
@@ -400,8 +401,9 @@ read_command (void)
if (tmout_var && var_isset (tmout_var))
{
tmout_len = atoi (value_cell (tmout_var));
if (tmout_len > 0)
t = value_cell (tmout_var);
tmout_len = (int)strtol (t, &e, 10);
if (e != t && *e == '\0' && tmout_len > 0)
{
old_alrm = set_signal_handler (SIGALRM, alrm_catcher);
alarm (tmout_len);
+17 -1
View File
@@ -1,6 +1,22 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Toy nohup implementation
(
if [ -t 1 ]; then
exec 1>>nohup.out || exec 1>>~/nohup.out
command exec 1>>nohup.out || exec 1>>~/nohup.out
fi
if [ -t 2 ]; then
exec 2>&1
+3 -3
View File
@@ -1459,15 +1459,15 @@ conf_standard_path (void)
int
default_columns (void)
{
char *v;
char *v, *e;
int c;
c = -1;
v = get_string_value ("COLUMNS");
if (v && *v)
{
c = atoi (v);
if (c > 0)
c = (int)strtol (v, &e, 10);
if (e != v && *e == '\0' && c > 0)
return c;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1999-2020,2022 Free Software Foundation, Inc. */
/* Copyright (C) 1999-2026 Free Software Foundation, Inc. */
/* This file is part of GNU Bash, the Bourne Again SHell.
-39
View File
@@ -1,39 +0,0 @@
#if defined (READLINE_AUTOCOMPLETE)
/* Return the list of completions for the text between START and END.
FOUND_QUOTE is non-zero if we're completing a quoted word; if so,
QUOTE_CHAR is the delimiter. If NONTRIVIAL_P is nonzero, it gets
set to a flag saying whether or not the completion added anything
to the word. Not part of rl_complete_internal because it's too
hard to separate functions without postprocess_matches possibly being
called twice; here to support the autocompletion code. */
char **
_rl_generate_completions (start, end, found_quote, quote_char, nontrivial_p)
int start, end, found_quote, quote_char, *nontrivial_p;
{
rl_compentry_func_t *our_func;
char *text;
char **matches;
our_func = rl_completion_entry_function
? rl_completion_entry_function
: rl_filename_completion_function;
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
/* *nontrivial_p is set if the common prefix adds something to the word
being completed. */
if (nontrivial_p)
*nontrivial_p = matches && strcmp (text, matches[0]) != 0;
free (text);
/* Postprocess the matches */
if (matches == 0)
return (char **)0;
if (postprocess_matches (&matches, rl_filename_completion_desired) == 0)
return (char **)0;
return 0;
}
#endif
File diff suppressed because it is too large Load Diff
-6
View File
@@ -1,6 +0,0 @@
./rl-timeout readline1 0.5
./rl-timeout readline2 0.25
./rl-timeout callback1 0.5
./rl-timeout callback2 0.5
-245
View File
@@ -1,245 +0,0 @@
/* rl-timeout: test various readline builtin timeouts. */
/* Copyright (C) 2021 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Readline is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with readline. If not, see <http://www.gnu.org/licenses/>.
*/
/* Standard include files. stdio.h is required. */
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
/* Used for select(2) */
#include <sys/types.h>
#include <sys/select.h>
#include <errno.h>
#include <stdio.h>
/* Standard readline include files. */
#if defined (READLINE_LIBRARY)
# include "readline.h"
# include "history.h"
#else
# include <readline/readline.h>
# include <readline/history.h>
#endif
extern int errno;
static void cb_linehandler (char *);
int timeout_secs = 1, timeout_usecs = 0;
int running;
const char *prompt = "rl-timeout$ ";
/* **************************************************************** */
/* */
/* Example 1: readline () with rl_readline_state */
/* */
/* **************************************************************** */
void
rltest_timeout_readline1 ()
{
const char *temp;
rl_set_timeout (timeout_secs, timeout_usecs);
temp = readline (prompt);
if (RL_ISSTATE (RL_STATE_TIMEOUT))
printf ("timeout\n");
else if (temp == NULL)
printf ("no input line\n");
else
printf ("input line: %s\n", temp);
free ((void *) temp);
}
/* **************************************************************** */
/* */
/* Example 2: readline () with rl_timeout_event_hook */
/* */
/* **************************************************************** */
static int
timeout_handler ()
{
printf ("timeout\n");
return READERR;
}
void
rltest_timeout_readline2 ()
{
const char *temp;
rl_set_timeout (timeout_secs, timeout_usecs);
rl_timeout_event_hook = timeout_handler;
temp = readline (prompt);
if (temp == NULL)
printf ("no input line\n");
else
printf ("input line: %s\n", temp);
free ((void *)temp);
}
/* **************************************************************** */
/* */
/* Example 3: rl_callback_* () with rl_timeout_remaining */
/* */
/* **************************************************************** */
/* Callback function called for each line when accept-line executed, EOF
seen, or EOF character read. This sets a flag and returns; it could
also call exit(3). */
static void
cb_linehandler (char *line)
{
/* Can use ^D (stty eof) or `exit' to exit. */
if (line == NULL || strcmp (line, "exit") == 0)
{
if (line == 0)
printf ("\n");
printf ("exit\n");
/* This function needs to be called to reset the terminal settings,
and calling it from the line handler keeps one extra prompt from
being displayed. */
rl_callback_handler_remove ();
running = 0;
}
else
{
if (*line)
add_history (line);
printf ("input line: %s\n", line);
free (line);
}
}
void
rltest_timeout_callback1 ()
{
fd_set fds;
int r;
unsigned sec, usec;
rl_set_timeout (timeout_secs, timeout_usecs);
rl_callback_handler_install (prompt, cb_linehandler);
running = 1;
while (running)
{
FD_ZERO (&fds);
FD_SET (fileno (rl_instream), &fds);
r = rl_timeout_remaining (&sec, &usec);
if (r == 1)
{
struct timeval timeout = {sec, usec};
r = select (FD_SETSIZE, &fds, NULL, NULL, &timeout);
}
if (r < 0 && errno != EINTR)
{
perror ("rl-timeout: select");
rl_callback_handler_remove ();
break;
}
else if (r == 0)
{
printf ("rl-timeout: timeout\n");
rl_callback_handler_remove ();
break;
}
if (FD_ISSET (fileno (rl_instream), &fds))
rl_callback_read_char ();
}
printf ("rl-timeout: Event loop has exited\n");
}
/* **************************************************************** */
/* */
/* Example 4: rl_callback_* () with rl_timeout_event_hook */
/* */
/* **************************************************************** */
static int
cb_timeouthandler ()
{
printf ("timeout\n");
rl_callback_handler_remove ();
running = 0;
return READERR;
}
void
rltest_timeout_callback2 ()
{
int r;
rl_set_timeout (timeout_secs, timeout_usecs);
rl_timeout_event_hook = cb_timeouthandler;
rl_callback_handler_install (prompt, cb_linehandler);
running = 1;
while (running)
rl_callback_read_char ();
printf ("rl-timeout: Event loop has exited\n");
}
int
main (int argc, char **argv)
{
if (argc >= 2)
{
if (argc >= 3)
{
double timeout = atof (argv[2]);
if (timeout <= 0.0)
{
fprintf (stderr, "rl-timeout: specify a positive number for timeout.\n");
return 2;
}
else if (timeout > UINT_MAX)
{
fprintf (stderr, "rl-timeout: timeout too large.\n");
return 2;
}
timeout_secs = (unsigned) timeout;
timeout_usecs = (unsigned) ((timeout - timeout_secs) * 1000000 + 0.5);
}
if (strcmp (argv[1], "readline1") == 0)
rltest_timeout_readline1 ();
else if (strcmp (argv[1], "readline2") == 0)
rltest_timeout_readline2 ();
else if (strcmp (argv[1], "callback1") == 0)
rltest_timeout_callback1 ();
else if (strcmp (argv[1], "callback2") == 0)
rltest_timeout_callback2 ();
else
return 2;
}
else
{
fprintf (stderr, "usage: rl-timeout [readline1 | readline2 | callback1 | callback2] [timeout]\n");
return 2;
}
return 0;
}
-1
View File
@@ -1 +0,0 @@
N 3149) 5/1 To: peggy.gup@c Re: FW: Phone for Mike Dailey (2413 chars)N 3150) 5/1 Jason Cutcher RE: Phone for Mike Dailey (34705 chars)N 3151) 5/1 Wizards *****SPAM***** Relief (7291 chars)N 3152) 5/1 FCG Help Desk Case HD0000002533519, Medium, h (2537 chars)N 3153) 5/1 To: jrw11@case. HD0000002533519 (2247 chars)N 3154) 5/1 Peggy Watts Gup RE: [tis-staff] Boxes back to m (12903 chars)N 3155) 5/1 Debbie Andrews [firewall-changes] Firewa
+1 -1
View File
@@ -2,7 +2,7 @@
* shtty.c -- abstract interface to the terminal, focusing on capabilities.
*/
/* Copyright (C) 1999, 2022 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2022-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+19 -7
View File
@@ -6289,18 +6289,21 @@ void
sv_optind (const char *name)
{
SHELL_VAR *var;
char *tt;
char *t, *e;
int s;
var = find_variable ("OPTIND");
tt = var ? get_variable_value (var) : (char *)NULL;
t = var ? get_variable_value (var) : (char *)NULL;
/* Assume that if var->context < variable_context and variable_context > 0
then we are restoring the variables's previous state while returning
from a function. */
if (tt && *tt)
if (t && *t)
{
s = atoi (tt);
s = (int)strtol (t, &e, 10);
if (e == t || *e != '\0')
return; /* non-numeric value is a no-op */
/* According to POSIX, setting OPTIND=1 resets the internal state
of getopt (). */
@@ -6315,10 +6318,19 @@ sv_optind (const char *name)
void
sv_opterr (const char *name)
{
char *tt;
char *tt, *e;
int n;
tt = get_string_value ("OPTERR");
sh_opterr = (tt && *tt) ? atoi (tt) : 1;
if (tt == 0 || *tt == 0)
n = 1;
else
{
n = (int)strtol (tt, &e, 10);
if (e == tt || *e != '\0')
n = 1;
}
sh_opterr = n;
}
void
@@ -6583,7 +6595,7 @@ sv_childmax (const char *name)
int s;
tt = get_string_value (name);
s = (tt && *tt) ? atoi (tt) : 0;
s = (tt && *tt) ? (int)strtol (tt, (char **)NULL, 10) : 0;
set_maxchild (s);
}
#endif