fix for heuristic to detect case statements when parsing $() command substitutions to find history expansion; fix for history not being saved if a SIGHUP arrives during $PROMPT_COMMAND execution; workaround for Cygwin bug that results in bash incorrectly calculating the system pipe size

This commit is contained in:
Chet Ramey
2026-03-09 14:54:45 -04:00
parent d0b41c2c5f
commit 1f292e433e
16 changed files with 6183 additions and 366 deletions
+30 -1
View File
@@ -11776,7 +11776,7 @@ lib/sh/strtrans.c
builtins/read.def
- read_builtin: make sure i is >= 0 after a timeout longjmp before
trying to terminate input_string
From a report from Duncan Roe <duncan_roe@optusnet.com.au>
From a report from Duncan Roe <bduncan_roe@optusnet.com.au>
jobs.c,jobs.h
- wait_for_background_pids: now takes a new first argument, WFLAGS.
@@ -12755,5 +12755,34 @@ execute_cmd.c
if the redirections complete without errors, and defer environment
creation until after calling expand_assignment_statements()
3/5
---
subst.c
- skip_to_histexp: fix typo in change from 2/12 that resulted in
incorrect precedence for tests
Report and patch from Grisha Levit <grishalevit@gmail.com>
3/6
---
variables.c
- initialize_shell_variables: use enable_history_list instead of
remember_on_history to determine whether to initialize the history
variables for consistency, though they should have the same value
at this point
shell.c
- exit_shell: use enable_history_list instead of remember_on_history
to determine whether or not to save the history
sig.c
- termsig_handler: save the history if either remember_on_history or
enable_history_list is set (though only the latter should be
necessary)
Fixes problem with SIGHUP during $PROMPT_COMMAND evaluation
reported in https://savannah.gnu.org/bugs/index.php?68128
3/9
---
builtins/psize.c
- sigpipe: work around cygwin SIGPIPE delivery bug
Report and fix from Duncan Roe <bduncan_roe@optusnet.com.au>
+2
View File
@@ -625,6 +625,8 @@ po/ja.gmo f
po/ja.po f
po/ka.gmo f
po/ka.po f
po/kk.gmo f
po/kk.po f
po/ko.gmo f
po/ko.po f
po/lt.gmo f
+5 -1
View File
@@ -1,6 +1,6 @@
/* psize.c - Find pipe size. */
/* Copyright (C) 1987, 1991, 2022 Free Software Foundation, Inc.
/* Copyright (C) 1987, 1991, 2022, 2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -50,7 +50,11 @@ int nw;
sighandler
sigpipe (int sig)
{
#if defined (__CYGWIN__)
fprintf (stderr, "%d\n", nw - 128);
#else
fprintf (stderr, "%d\n", nw);
#endif
exit (0);
}
+23 -21
View File
@@ -1927,34 +1927,36 @@ EEXXPPAANNSSIIOONN
In each of the cases below, _w_o_r_d is subject to tilde expansion, parame-
ter expansion, command substitution, and arithmetic expansion.
When not performing substring expansion, using the forms documented be-
low (e.g., ::--), bbaasshh tests for a parameter that is unset or null.
Omitting the colon tests only for a parameter that is unset.
When performing the first four expansions documented below (::--, ::==, ::??,
and ::++), including the colon, bbaasshh tests for a parameter that is unset
or null. Omitting the colon tests only for a parameter that is unset.
${_p_a_r_a_m_e_t_e_r::--_w_o_r_d}
UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the expan-
sion of _w_o_r_d is substituted. Otherwise, the value of _p_a_r_a_m_e_t_e_r
is substituted.
UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if
the colon is not present, the expansion of _w_o_r_d is substituted.
Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted.
${_p_a_r_a_m_e_t_e_r::==_w_o_r_d}
AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, the ex-
pansion of _w_o_r_d is assigned to _p_a_r_a_m_e_t_e_r, and the expansion is
the final value of _p_a_r_a_m_e_t_e_r. Positional parameters and special
parameters may not be assigned in this way.
AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset
if the colon is not present, the expansion of _w_o_r_d is assigned
to _p_a_r_a_m_e_t_e_r, and the expansion is the final value of _p_a_r_a_m_e_t_e_r.
Positional parameters and special parameters may not be assigned
in this way.
${_p_a_r_a_m_e_t_e_r::??_w_o_r_d}
DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is null or unset,
the shell writes the expansion of _w_o_r_d (or a message to that ef-
fect if _w_o_r_d is not present) to the standard error and, if it is
not interactive, exits with a non-zero status. An interactive
shell does not exit, but does not execute the command associated
with the expansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is sub-
stituted.
DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is unset or null,
or unset if the colon is not present, the shell writes the ex-
pansion of _w_o_r_d (or a message to that effect if _w_o_r_d is not
present) to the standard error and, if it is not interactive,
exits with a non-zero status. An interactive shell does not
exit, but does not execute the command associated with the ex-
pansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted.
${_p_a_r_a_m_e_t_e_r::++_w_o_r_d}
UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is null or unset, nothing is
substituted, otherwise the expansion of _w_o_r_d is substituted.
The value of _p_a_r_a_m_e_t_e_r is not used.
UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if
the colon is not present, nothing is substituted, otherwise the
expansion of _w_o_r_d is substituted. The value of _p_a_r_a_m_e_t_e_r is not
used.
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t}
${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h}
@@ -7618,4 +7620,4 @@ BBUUGGSS
Array variables may not (yet) be exported.
GNU Bash 5.3 2026 January 14 _B_A_S_H(1)
GNU Bash 5.3 2026 March 3 _B_A_S_H(1)
+17 -8
View File
@@ -5,7 +5,7 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Jan 14 15:46:08 EST 2026
.\" Last Change: Tue Mar 3 10:52:34 EST 2026
.\"
.\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section
.\" For rbash, strip all but "RESTRICTED SHELL" section
@@ -22,7 +22,7 @@
.ds zX \" empty
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2026 January 14" "GNU Bash 5.3"
.TH BASH 1 "2026 March 3" "GNU Bash 5.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -3725,8 +3725,9 @@ introduce indirection.
In each of the cases below, \fIword\fP is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
.PP
When not performing substring expansion, using the forms documented below
(e.g., \fB:-\fP),
When performing the first four expansions documented below
(\fB:-\fP, \fB:=\fP, \fB:?\fP, and \fB:+\fP),
including the colon,
\fBbash\fP tests for a parameter that is unset or null.
Omitting the colon tests only for a parameter that is unset.
.PP
@@ -3734,7 +3735,9 @@ Omitting the colon tests only for a parameter that is unset.
${\fIparameter\fP\fB:\-\fP\fIword\fP}
\fBUse Default Values\fP. If
.I parameter
is unset or null, the expansion of
is unset or null,
or unset if the colon is not present,
the expansion of
.I word
is substituted.
Otherwise, the value of
@@ -3745,7 +3748,9 @@ ${\fIparameter\fP\fB:=\fP\fIword\fP}
\fBAssign Default Values\fP.
If
.I parameter
is unset or null, the expansion of
is unset or null,
or unset if the colon is not present,
the expansion of
.I word
is assigned to
.IR parameter ,
@@ -3758,7 +3763,9 @@ ${\fIparameter\fP\fB:?\fP\fIword\fP}
\fBDisplay Error if Null or Unset\fP.
If
.I parameter
is null or unset, the shell writes
is unset or null,
or unset if the colon is not present,
the shell writes
the expansion of \fIword\fP (or a message to that effect
if
.I word
@@ -3772,7 +3779,9 @@ ${\fIparameter\fP\fB:+\fP\fIword\fP}
\fBUse Alternate Value\fP.
If
.I parameter
is null or unset, nothing is substituted, otherwise the expansion of
is unset or null,
or unset if the colon is not present,
nothing is substituted, otherwise the expansion of
.I word
is substituted.
The value of \fIparameter\fP is not used.
+161 -158
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 7.2 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 27 February 2026).
Bash shell (version 5.3, 3 March 2026).
This is Edition 5.3, last updated 27 February 2026, of The GNU Bash
This is Edition 5.3, last updated 3 March 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 27 February 2026). The Bash home page is
Bash shell (version 5.3, 3 March 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 27 February 2026, of The GNU Bash
This is Edition 5.3, last updated 3 March 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -1896,16 +1896,17 @@ introduce indirection.
In each of the cases below, WORD is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
When not performing substring expansion, using the forms described
below (e.g., :), Bash tests for a parameter that is unset or null.
Omitting the colon results in a test only for a parameter that is unset.
Put another way, if the colon is included, the operator tests for both
PARAMETER's existence and that its value is not null; if the colon is
omitted, the operator tests only for existence.
When performing the first four expansions documented below (:-,
:=, :?, and :+), including the colon, Bash tests for a parameter
that is unset or null. Omitting the colon results in a test only for a
parameter that is unset. Put another way, if the colon is included, the
operator tests for both PARAMETER's existence and that its value is not
null; if the colon is omitted, the operator tests only for existence.
${PARAMETER:WORD}
If PARAMETER is unset or null, the expansion of WORD is
substituted. Otherwise, the value of PARAMETER is substituted.
If PARAMETER is unset or null, or unset if the colon is not
present, the expansion of WORD is substituted. Otherwise, the
value of PARAMETER is substituted.
$ v=123
$ echo ${v-unset}
@@ -1922,10 +1923,11 @@ omitted, the operator tests only for existence.
unset-or-null
${PARAMETER:=WORD}
If PARAMETER is unset or null, the expansion of WORD is assigned to
PARAMETER, and the result of the expansion is the final value of
PARAMETER. Positional parameters and special parameters may not be
assigned in this way.
If PARAMETER is unset or null, or unset if the colon is not
present, the expansion of WORD is assigned to PARAMETER, and the
result of the expansion is the final value of PARAMETER.
Positional parameters and special parameters may not be assigned in
this way.
$ unset var
$ : ${var=DEFAULT}
@@ -1945,12 +1947,13 @@ omitted, the operator tests only for existence.
DEFAULT
${PARAMETER:?WORD}
If PARAMETER is null or unset, the shell writes the expansion of
WORD (or a message to that effect if WORD is not present) to the
standard error and, if it is not interactive, exits with a non-zero
status. An interactive shell does not exit, but does not execute
the command associated with the expansion. Otherwise, the value of
PARAMETER is substituted.
If PARAMETER is unset or null, or unset if the colon is not
present, the shell writes the expansion of WORD (or a message to
that effect if WORD is not present) to the standard error and, if
it is not interactive, exits with a non-zero status. An
interactive shell does not exit, but does not execute the command
associated with the expansion. Otherwise, the value of PARAMETER
is substituted.
$ var=
$ : ${var:?var is unset or null}
@@ -1967,9 +1970,9 @@ omitted, the operator tests only for existence.
123
${PARAMETER:+WORD}
If PARAMETER is null or unset, nothing is substituted, otherwise
the expansion of WORD is substituted. The value of PARAMETER is
not used.
If PARAMETER is unset or null, or unset if the colon is not
present, nothing is substituted, otherwise the expansion of WORD is
substituted. The value of PARAMETER is not used.
$ var=123
$ echo ${var:+var is set and not null}
@@ -7163,7 +7166,7 @@ shell variables may also be referenced by name without using the
parameter expansion syntax. This means you can use X, where X is a
shell variable name, in an arithmetic expression, and the shell will
evaluate its value as an expression and use the result. A shell
variable that is null or unset evaluates to 0 when referenced by name in
variable that is unset or null evaluates to 0 when referenced by name in
an expression.
The value of a variable is evaluated as an arithmetic expression when
@@ -13735,138 +13738,138 @@ D.5 Concept Index

Tag Table:
Node: Top901
Node: Introduction2842
Node: What is Bash?3055
Node: What is a shell?4188
Node: Definitions6798
Node: Basic Shell Features10125
Node: Shell Syntax11349
Node: Shell Operation12376
Node: Quoting13667
Node: Escape Character15005
Node: Single Quotes15540
Node: Double Quotes15889
Node: ANSI-C Quoting17234
Node: Locale Translation18628
Node: Creating Internationalized Scripts20031
Node: Comments24229
Node: Shell Commands24996
Node: Reserved Words25935
Node: Simple Commands27078
Node: Pipelines27740
Node: Lists30996
Node: Compound Commands32945
Node: Looping Constructs33954
Node: Conditional Constructs36503
Node: Command Grouping51640
Node: Coprocesses53132
Node: GNU Parallel55818
Node: Shell Functions56736
Node: Shell Parameters65184
Node: Positional Parameters70085
Node: Special Parameters71175
Node: Shell Expansions74636
Node: Brace Expansion76825
Node: Tilde Expansion80161
Node: Shell Parameter Expansion83116
Node: Command Substitution103763
Node: Arithmetic Expansion107614
Node: Process Substitution108790
Node: Word Splitting109898
Node: Filename Expansion112342
Node: Pattern Matching115566
Node: Quote Removal121332
Node: Redirections121636
Node: Executing Commands131892
Node: Simple Command Expansion132559
Node: Command Search and Execution134667
Node: Command Execution Environment137111
Node: Environment140637
Node: Exit Status142540
Node: Signals144599
Node: Shell Scripts149547
Node: Shell Builtin Commands152845
Node: Bourne Shell Builtins155186
Node: Bash Builtins181905
Node: Modifying Shell Behavior219641
Node: The Set Builtin219983
Node: The Shopt Builtin231977
Node: Special Builtins249030
Node: Shell Variables250019
Node: Bourne Shell Variables250453
Node: Bash Variables252961
Node: Bash Features292245
Node: Invoking Bash293259
Node: Bash Startup Files299843
Node: Interactive Shells305085
Node: What is an Interactive Shell?305493
Node: Is this Shell Interactive?306155
Node: Interactive Shell Behavior306979
Node: Bash Conditional Expressions310740
Node: Shell Arithmetic316157
Node: Aliases319484
Node: Arrays322618
Node: The Directory Stack330321
Node: Directory Stack Builtins331118
Node: Controlling the Prompt335563
Node: The Restricted Shell338447
Node: Bash POSIX Mode341540
Node: Shell Compatibility Mode361356
Node: Job Control370363
Node: Job Control Basics370820
Node: Job Control Builtins377188
Node: Job Control Variables383976
Node: Command Line Editing385207
Node: Introduction and Notation386910
Node: Readline Interaction389262
Node: Readline Bare Essentials390450
Node: Readline Movement Commands392258
Node: Readline Killing Commands393254
Node: Readline Arguments395277
Node: Searching396367
Node: Readline Init File398610
Node: Readline Init File Syntax399913
Node: Conditional Init Constructs426864
Node: Sample Init File431249
Node: Bindable Readline Commands434369
Node: Commands For Moving435907
Node: Commands For History438371
Node: Commands For Text443762
Node: Commands For Killing447887
Node: Numeric Arguments450675
Node: Commands For Completion451827
Node: Keyboard Macros457523
Node: Miscellaneous Commands458224
Node: Readline vi Mode465767
Node: Programmable Completion466744
Node: Programmable Completion Builtins476480
Node: A Programmable Completion Example488217
Node: Using History Interactively493562
Node: Bash History Facilities494243
Node: Bash History Builtins497978
Node: History Interaction505573
Node: Event Designators510523
Node: Word Designators512101
Node: Modifiers514493
Node: Installing Bash516430
Node: Basic Installation517546
Node: Compilers and Options521422
Node: Compiling For Multiple Architectures522172
Node: Installation Names523925
Node: Specifying the System Type526159
Node: Sharing Defaults526905
Node: Operation Controls527619
Node: Optional Features528638
Node: Reporting Bugs541361
Node: Major Differences From The Bourne Shell542718
Node: GNU Free Documentation License564145
Node: Indexes589322
Node: Builtin Index589773
Node: Reserved Word Index596871
Node: Variable Index599316
Node: Function Index616729
Node: Concept Index630862
Node: Top893
Node: Introduction2826
Node: What is Bash?3039
Node: What is a shell?4172
Node: Definitions6782
Node: Basic Shell Features10109
Node: Shell Syntax11333
Node: Shell Operation12360
Node: Quoting13651
Node: Escape Character14989
Node: Single Quotes15524
Node: Double Quotes15873
Node: ANSI-C Quoting17218
Node: Locale Translation18612
Node: Creating Internationalized Scripts20015
Node: Comments24213
Node: Shell Commands24980
Node: Reserved Words25919
Node: Simple Commands27062
Node: Pipelines27724
Node: Lists30980
Node: Compound Commands32929
Node: Looping Constructs33938
Node: Conditional Constructs36487
Node: Command Grouping51624
Node: Coprocesses53116
Node: GNU Parallel55802
Node: Shell Functions56720
Node: Shell Parameters65168
Node: Positional Parameters70069
Node: Special Parameters71159
Node: Shell Expansions74620
Node: Brace Expansion76809
Node: Tilde Expansion80145
Node: Shell Parameter Expansion83100
Node: Command Substitution103948
Node: Arithmetic Expansion107799
Node: Process Substitution108975
Node: Word Splitting110083
Node: Filename Expansion112527
Node: Pattern Matching115751
Node: Quote Removal121517
Node: Redirections121821
Node: Executing Commands132077
Node: Simple Command Expansion132744
Node: Command Search and Execution134852
Node: Command Execution Environment137296
Node: Environment140822
Node: Exit Status142725
Node: Signals144784
Node: Shell Scripts149732
Node: Shell Builtin Commands153030
Node: Bourne Shell Builtins155371
Node: Bash Builtins182090
Node: Modifying Shell Behavior219826
Node: The Set Builtin220168
Node: The Shopt Builtin232162
Node: Special Builtins249215
Node: Shell Variables250204
Node: Bourne Shell Variables250638
Node: Bash Variables253146
Node: Bash Features292430
Node: Invoking Bash293444
Node: Bash Startup Files300028
Node: Interactive Shells305270
Node: What is an Interactive Shell?305678
Node: Is this Shell Interactive?306340
Node: Interactive Shell Behavior307164
Node: Bash Conditional Expressions310925
Node: Shell Arithmetic316342
Node: Aliases319669
Node: Arrays322803
Node: The Directory Stack330506
Node: Directory Stack Builtins331303
Node: Controlling the Prompt335748
Node: The Restricted Shell338632
Node: Bash POSIX Mode341725
Node: Shell Compatibility Mode361541
Node: Job Control370548
Node: Job Control Basics371005
Node: Job Control Builtins377373
Node: Job Control Variables384161
Node: Command Line Editing385392
Node: Introduction and Notation387095
Node: Readline Interaction389447
Node: Readline Bare Essentials390635
Node: Readline Movement Commands392443
Node: Readline Killing Commands393439
Node: Readline Arguments395462
Node: Searching396552
Node: Readline Init File398795
Node: Readline Init File Syntax400098
Node: Conditional Init Constructs427049
Node: Sample Init File431434
Node: Bindable Readline Commands434554
Node: Commands For Moving436092
Node: Commands For History438556
Node: Commands For Text443947
Node: Commands For Killing448072
Node: Numeric Arguments450860
Node: Commands For Completion452012
Node: Keyboard Macros457708
Node: Miscellaneous Commands458409
Node: Readline vi Mode465952
Node: Programmable Completion466929
Node: Programmable Completion Builtins476665
Node: A Programmable Completion Example488402
Node: Using History Interactively493747
Node: Bash History Facilities494428
Node: Bash History Builtins498163
Node: History Interaction505758
Node: Event Designators510708
Node: Word Designators512286
Node: Modifiers514678
Node: Installing Bash516615
Node: Basic Installation517731
Node: Compilers and Options521607
Node: Compiling For Multiple Architectures522357
Node: Installation Names524110
Node: Specifying the System Type526344
Node: Sharing Defaults527090
Node: Operation Controls527804
Node: Optional Features528823
Node: Reporting Bugs541546
Node: Major Differences From The Bourne Shell542903
Node: GNU Free Documentation License564330
Node: Indexes589507
Node: Builtin Index589958
Node: Reserved Word Index597056
Node: Variable Index599501
Node: Function Index616914
Node: Concept Index631047

End Tag Table
+161 -158
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 7.2 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 27 February 2026).
Bash shell (version 5.3, 3 March 2026).
This is Edition 5.3, last updated 27 February 2026, of The GNU Bash
This is Edition 5.3, last updated 3 March 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 27 February 2026). The Bash home page is
Bash shell (version 5.3, 3 March 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 27 February 2026, of The GNU Bash
This is Edition 5.3, last updated 3 March 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -1897,16 +1897,17 @@ introduce indirection.
In each of the cases below, WORD is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
When not performing substring expansion, using the forms described
below (e.g., :), Bash tests for a parameter that is unset or null.
Omitting the colon results in a test only for a parameter that is unset.
Put another way, if the colon is included, the operator tests for both
PARAMETER's existence and that its value is not null; if the colon is
omitted, the operator tests only for existence.
When performing the first four expansions documented below (:-,
:=, :?, and :+), including the colon, Bash tests for a parameter
that is unset or null. Omitting the colon results in a test only for a
parameter that is unset. Put another way, if the colon is included, the
operator tests for both PARAMETER's existence and that its value is not
null; if the colon is omitted, the operator tests only for existence.
${PARAMETER:WORD}
If PARAMETER is unset or null, the expansion of WORD is
substituted. Otherwise, the value of PARAMETER is substituted.
If PARAMETER is unset or null, or unset if the colon is not
present, the expansion of WORD is substituted. Otherwise, the
value of PARAMETER is substituted.
$ v=123
$ echo ${v-unset}
@@ -1923,10 +1924,11 @@ omitted, the operator tests only for existence.
unset-or-null
${PARAMETER:=WORD}
If PARAMETER is unset or null, the expansion of WORD is assigned to
PARAMETER, and the result of the expansion is the final value of
PARAMETER. Positional parameters and special parameters may not be
assigned in this way.
If PARAMETER is unset or null, or unset if the colon is not
present, the expansion of WORD is assigned to PARAMETER, and the
result of the expansion is the final value of PARAMETER.
Positional parameters and special parameters may not be assigned in
this way.
$ unset var
$ : ${var=DEFAULT}
@@ -1946,12 +1948,13 @@ omitted, the operator tests only for existence.
DEFAULT
${PARAMETER:?WORD}
If PARAMETER is null or unset, the shell writes the expansion of
WORD (or a message to that effect if WORD is not present) to the
standard error and, if it is not interactive, exits with a non-zero
status. An interactive shell does not exit, but does not execute
the command associated with the expansion. Otherwise, the value of
PARAMETER is substituted.
If PARAMETER is unset or null, or unset if the colon is not
present, the shell writes the expansion of WORD (or a message to
that effect if WORD is not present) to the standard error and, if
it is not interactive, exits with a non-zero status. An
interactive shell does not exit, but does not execute the command
associated with the expansion. Otherwise, the value of PARAMETER
is substituted.
$ var=
$ : ${var:?var is unset or null}
@@ -1968,9 +1971,9 @@ omitted, the operator tests only for existence.
123
${PARAMETER:+WORD}
If PARAMETER is null or unset, nothing is substituted, otherwise
the expansion of WORD is substituted. The value of PARAMETER is
not used.
If PARAMETER is unset or null, or unset if the colon is not
present, nothing is substituted, otherwise the expansion of WORD is
substituted. The value of PARAMETER is not used.
$ var=123
$ echo ${var:+var is set and not null}
@@ -7164,7 +7167,7 @@ shell variables may also be referenced by name without using the
parameter expansion syntax. This means you can use X, where X is a
shell variable name, in an arithmetic expression, and the shell will
evaluate its value as an expression and use the result. A shell
variable that is null or unset evaluates to 0 when referenced by name in
variable that is unset or null evaluates to 0 when referenced by name in
an expression.
The value of a variable is evaluated as an arithmetic expression when
@@ -13736,138 +13739,138 @@ D.5 Concept Index

Tag Table:
Node: Top904
Node: Introduction2848
Node: What is Bash?3064
Node: What is a shell?4200
Node: Definitions6813
Node: Basic Shell Features10143
Node: Shell Syntax11370
Node: Shell Operation12400
Node: Quoting13694
Node: Escape Character15035
Node: Single Quotes15573
Node: Double Quotes15925
Node: ANSI-C Quoting17273
Node: Locale Translation18670
Node: Creating Internationalized Scripts20076
Node: Comments24277
Node: Shell Commands25047
Node: Reserved Words25989
Node: Simple Commands27135
Node: Pipelines27800
Node: Lists31059
Node: Compound Commands33011
Node: Looping Constructs34023
Node: Conditional Constructs36575
Node: Command Grouping51715
Node: Coprocesses53210
Node: GNU Parallel55899
Node: Shell Functions56820
Node: Shell Parameters65271
Node: Positional Parameters70175
Node: Special Parameters71268
Node: Shell Expansions74732
Node: Brace Expansion76924
Node: Tilde Expansion80263
Node: Shell Parameter Expansion83221
Node: Command Substitution103871
Node: Arithmetic Expansion107725
Node: Process Substitution108904
Node: Word Splitting110015
Node: Filename Expansion112462
Node: Pattern Matching115689
Node: Quote Removal121458
Node: Redirections121765
Node: Executing Commands132024
Node: Simple Command Expansion132694
Node: Command Search and Execution134805
Node: Command Execution Environment137252
Node: Environment140781
Node: Exit Status142687
Node: Signals144749
Node: Shell Scripts149700
Node: Shell Builtin Commands153001
Node: Bourne Shell Builtins155345
Node: Bash Builtins182067
Node: Modifying Shell Behavior219806
Node: The Set Builtin220151
Node: The Shopt Builtin232148
Node: Special Builtins249204
Node: Shell Variables250196
Node: Bourne Shell Variables250633
Node: Bash Variables253144
Node: Bash Features292431
Node: Invoking Bash293448
Node: Bash Startup Files300035
Node: Interactive Shells305280
Node: What is an Interactive Shell?305691
Node: Is this Shell Interactive?306356
Node: Interactive Shell Behavior307183
Node: Bash Conditional Expressions310947
Node: Shell Arithmetic316367
Node: Aliases319697
Node: Arrays322834
Node: The Directory Stack330540
Node: Directory Stack Builtins331340
Node: Controlling the Prompt335788
Node: The Restricted Shell338675
Node: Bash POSIX Mode341771
Node: Shell Compatibility Mode361590
Node: Job Control370600
Node: Job Control Basics371060
Node: Job Control Builtins377431
Node: Job Control Variables384222
Node: Command Line Editing385456
Node: Introduction and Notation387162
Node: Readline Interaction389517
Node: Readline Bare Essentials390708
Node: Readline Movement Commands392519
Node: Readline Killing Commands393518
Node: Readline Arguments395544
Node: Searching396637
Node: Readline Init File398883
Node: Readline Init File Syntax400189
Node: Conditional Init Constructs427143
Node: Sample Init File431531
Node: Bindable Readline Commands434654
Node: Commands For Moving436195
Node: Commands For History438662
Node: Commands For Text444056
Node: Commands For Killing448184
Node: Numeric Arguments450975
Node: Commands For Completion452130
Node: Keyboard Macros457829
Node: Miscellaneous Commands458533
Node: Readline vi Mode466079
Node: Programmable Completion467059
Node: Programmable Completion Builtins476798
Node: A Programmable Completion Example488538
Node: Using History Interactively493886
Node: Bash History Facilities494570
Node: Bash History Builtins498308
Node: History Interaction505906
Node: Event Designators510859
Node: Word Designators512440
Node: Modifiers514835
Node: Installing Bash516775
Node: Basic Installation517894
Node: Compilers and Options521773
Node: Compiling For Multiple Architectures522526
Node: Installation Names524282
Node: Specifying the System Type526519
Node: Sharing Defaults527268
Node: Operation Controls527985
Node: Optional Features529007
Node: Reporting Bugs541733
Node: Major Differences From The Bourne Shell543093
Node: GNU Free Documentation License564523
Node: Indexes589703
Node: Builtin Index590157
Node: Reserved Word Index597258
Node: Variable Index599706
Node: Function Index617122
Node: Concept Index631258
Node: Top896
Node: Introduction2832
Node: What is Bash?3048
Node: What is a shell?4184
Node: Definitions6797
Node: Basic Shell Features10127
Node: Shell Syntax11354
Node: Shell Operation12384
Node: Quoting13678
Node: Escape Character15019
Node: Single Quotes15557
Node: Double Quotes15909
Node: ANSI-C Quoting17257
Node: Locale Translation18654
Node: Creating Internationalized Scripts20060
Node: Comments24261
Node: Shell Commands25031
Node: Reserved Words25973
Node: Simple Commands27119
Node: Pipelines27784
Node: Lists31043
Node: Compound Commands32995
Node: Looping Constructs34007
Node: Conditional Constructs36559
Node: Command Grouping51699
Node: Coprocesses53194
Node: GNU Parallel55883
Node: Shell Functions56804
Node: Shell Parameters65255
Node: Positional Parameters70159
Node: Special Parameters71252
Node: Shell Expansions74716
Node: Brace Expansion76908
Node: Tilde Expansion80247
Node: Shell Parameter Expansion83205
Node: Command Substitution104056
Node: Arithmetic Expansion107910
Node: Process Substitution109089
Node: Word Splitting110200
Node: Filename Expansion112647
Node: Pattern Matching115874
Node: Quote Removal121643
Node: Redirections121950
Node: Executing Commands132209
Node: Simple Command Expansion132879
Node: Command Search and Execution134990
Node: Command Execution Environment137437
Node: Environment140966
Node: Exit Status142872
Node: Signals144934
Node: Shell Scripts149885
Node: Shell Builtin Commands153186
Node: Bourne Shell Builtins155530
Node: Bash Builtins182252
Node: Modifying Shell Behavior219991
Node: The Set Builtin220336
Node: The Shopt Builtin232333
Node: Special Builtins249389
Node: Shell Variables250381
Node: Bourne Shell Variables250818
Node: Bash Variables253329
Node: Bash Features292616
Node: Invoking Bash293633
Node: Bash Startup Files300220
Node: Interactive Shells305465
Node: What is an Interactive Shell?305876
Node: Is this Shell Interactive?306541
Node: Interactive Shell Behavior307368
Node: Bash Conditional Expressions311132
Node: Shell Arithmetic316552
Node: Aliases319882
Node: Arrays323019
Node: The Directory Stack330725
Node: Directory Stack Builtins331525
Node: Controlling the Prompt335973
Node: The Restricted Shell338860
Node: Bash POSIX Mode341956
Node: Shell Compatibility Mode361775
Node: Job Control370785
Node: Job Control Basics371245
Node: Job Control Builtins377616
Node: Job Control Variables384407
Node: Command Line Editing385641
Node: Introduction and Notation387347
Node: Readline Interaction389702
Node: Readline Bare Essentials390893
Node: Readline Movement Commands392704
Node: Readline Killing Commands393703
Node: Readline Arguments395729
Node: Searching396822
Node: Readline Init File399068
Node: Readline Init File Syntax400374
Node: Conditional Init Constructs427328
Node: Sample Init File431716
Node: Bindable Readline Commands434839
Node: Commands For Moving436380
Node: Commands For History438847
Node: Commands For Text444241
Node: Commands For Killing448369
Node: Numeric Arguments451160
Node: Commands For Completion452315
Node: Keyboard Macros458014
Node: Miscellaneous Commands458718
Node: Readline vi Mode466264
Node: Programmable Completion467244
Node: Programmable Completion Builtins476983
Node: A Programmable Completion Example488723
Node: Using History Interactively494071
Node: Bash History Facilities494755
Node: Bash History Builtins498493
Node: History Interaction506091
Node: Event Designators511044
Node: Word Designators512625
Node: Modifiers515020
Node: Installing Bash516960
Node: Basic Installation518079
Node: Compilers and Options521958
Node: Compiling For Multiple Architectures522711
Node: Installation Names524467
Node: Specifying the System Type526704
Node: Sharing Defaults527453
Node: Operation Controls528170
Node: Optional Features529192
Node: Reporting Bugs541918
Node: Major Differences From The Bourne Shell543278
Node: GNU Free Documentation License564708
Node: Indexes589888
Node: Builtin Index590342
Node: Reserved Word Index597443
Node: Variable Index599891
Node: Function Index617307
Node: Concept Index631443

End Tag Table
+20 -7
View File
@@ -2306,8 +2306,10 @@ introduce indirection.
In each of the cases below, @var{word} is subject to tilde expansion,
parameter expansion, command substitution, and arithmetic expansion.
When not performing substring expansion, using the forms described
below (e.g., @samp{:@minus{}}), Bash tests for a parameter that is unset or null.
When performing the first four expansions documented below
(@samp{:-}, @samp{:=}, @samp{:?}, and @samp{:+}),
including the colon,
Bash tests for a parameter that is unset or null.
Omitting the colon results in a test only for a parameter that is unset.
Put another way, if the colon is included,
the operator tests for both @var{parameter}'s existence and that its value
@@ -2316,7 +2318,10 @@ is not null; if the colon is omitted, the operator tests only for existence.
@table @code
@item $@{@var{parameter}:@minus{}@var{word}@}
If @var{parameter} is unset or null, the expansion of
If @var{parameter}
is unset or null,
or unset if the colon is not present,
the expansion of
@var{word} is substituted.
Otherwise, the value of @var{parameter} is substituted.
@@ -2337,7 +2342,10 @@ unset-or-null
@end example
@item $@{@var{parameter}:=@var{word}@}
If @var{parameter} is unset or null, the expansion of @var{word}
If @var{parameter}
is unset or null,
or unset if the colon is not present,
the expansion of @var{word}
is assigned to @var{parameter},
and the result of the expansion
is the final value of @var{parameter}.
@@ -2365,7 +2373,9 @@ DEFAULT
@item $@{@var{parameter}:?@var{word}@}
If @var{parameter}
is null or unset, the shell writes
is unset or null,
or unset if the colon is not present,
the shell writes
the expansion of @var{word} (or a message
to that effect if @var{word}
is not present) to the standard error and, if it
@@ -2392,7 +2402,10 @@ $ echo $@{var:?var is unset or null@}
@item $@{@var{parameter}:+@var{word}@}
If @var{parameter}
is null or unset, nothing is substituted, otherwise the expansion of
is unset or null,
or unset if the colon is not present,
nothing is substituted,
otherwise the expansion of
@var{word} is substituted.
The value of @var{parameter} is not used.
@@ -8569,7 +8582,7 @@ This means you can use @var{x},
where @var{x} is a shell variable name, in an arithmetic expression,
and the shell will evaluate its value as an expression and use the
result.
A shell variable that is null or unset evaluates to 0 when referenced
A shell variable that is unset or null evaluates to 0 when referenced
by name in an expression.
The value of a variable is evaluated as an arithmetic expression
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2026 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Feb 27 12:23:35 EST 2026
@set LASTCHANGE Tue Mar 3 10:46:54 EST 2026
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 27 February 2026
@set UPDATED-MONTH February 2026
@set UPDATED 3 March 2026
@set UPDATED-MONTH March 2026
+1 -1
View File
@@ -1,2 +1,2 @@
# Set of available languages.
en@quot en@boldquot af ar bg ca cs da de el eo es et fi fr ga gl hr hu id it ja ka ko lt nb nl pl pt pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN zh_TW
en@quot en@boldquot af ar bg ca cs da de el eo es et fi fr ga gl hr hu id it ja ka kk ko lt nb nl pl pt pt_BR ro ru sk sl sq sr sv tr uk vi zh_CN zh_TW
BIN
View File
Binary file not shown.
+5754
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1005,7 +1005,7 @@ exit_shell (int s)
#endif /* PROCESS_SUBSTITUTION */
#if defined (HISTORY)
if (remember_on_history)
if (enable_history_list)
maybe_save_shell_history ();
#endif /* HISTORY */
+1 -1
View File
@@ -616,7 +616,7 @@ termsig_handler (int sig)
an interactive shell is running in a terminal window that gets closed
with the `close' button. We can't test for RL_STATE_READCMD because
readline no longer handles SIGTERM synchronously. */
if (interactive_shell && interactive && (sig == SIGHUP || sig == SIGTERM) && remember_on_history)
if (interactive_shell && interactive && (sig == SIGHUP || sig == SIGTERM) && (remember_on_history || enable_history_list))
maybe_save_shell_history ();
#endif /* HISTORY */
+2 -4
View File
@@ -2505,8 +2505,7 @@ skip_to_histexp (const char *string, int start, const char *delims, int flags)
continue;
}
else if (histexp_comsub && c == 'c' &&
(i == 0) || shellbreak (string[i-1]) && /* incomplete reserved word eligibility test */
(i <= slen - 4) &&
(i == 0 || shellbreak (string[i-1])) && /* incomplete reserved word eligibility test */
string[i+1] == 'a' && string[i+2] == 's' && string[i+3] == 'e' &&
(shellblank (string[i+4]) || string[i+4] == '\0'))
{
@@ -2516,8 +2515,7 @@ skip_to_histexp (const char *string, int start, const char *delims, int flags)
continue;
}
else if (histexp_comsub && c == 'e' &&
(i == 0) || shellbreak (string[i-1]) && /* incomplete reserved word eligibility test */
(i <= slen - 4) &&
(i == 0 || shellbreak (string[i-1])) && /* incomplete reserved word eligibility test */
string[i+1] == 's' && string[i+2] == 'a' && string[i+3] == 'c' &&
(shellbreak (string[i+4]) || string[i+4] == '\0'))
{
+2 -2
View File
@@ -652,7 +652,7 @@ initialize_shell_variables (char **env, int privmode)
/* Set history variables to defaults, and then do whatever we would
do if the variable had just been set. Do this only in the case
that we are remembering commands on the history list. */
if (remember_on_history)
if (enable_history_list)
{
name = bash_default_histfile ();
@@ -677,7 +677,7 @@ initialize_shell_variables (char **env, int privmode)
}
#if defined (HISTORY)
if (interactive_shell && remember_on_history)
if (interactive_shell && enable_history_list)
{
sv_history_control ("HISTCONTROL");
sv_histignore ("HISTIGNORE");