changed version to bash-5.4-devel; new non-recursive implementation for command list execution; extended new compound assignment word splitting behavior to declaration commands; fixed issue with shell not ignoring -n at invocation unless forced interactive with -i

This commit is contained in:
Chet Ramey
2026-08-21 17:09:27 -04:00
parent 2f7eb80c77
commit 71327ab3b5
23 changed files with 619 additions and 418 deletions
+32
View File
@@ -13229,3 +13229,35 @@ builtins/shopt.def
doc/bash.1,doc/bashref.texi
- kvpair_split: added description to shopt builtin; added paragraph
to Arrays section describing its effect
8/15
----
configure.ac,version.c
- changed the version to bash-5.4-devel and updated the copyright year
execute_cmd.c
- execute_list: alternate implementation that uses an explicit stack
instead of recursion to execute `;' and `\n' separated lists.
Depends on NON_RECURSIVE_LISTS define
config-top.h
- NON_RECURSIVE_LISTS: define to 1 (at least for now), enabling new
non-recursive list execution implementation
8/19
----
subst.c
- expand_oneword: if we detect a key-value pair compound assignment
as an argument to a declaration command, honor the setting of
kvpair_split: expand all the words in the list, then single-quote
the result and return that list
8/20
----
shell.c
- main: force read_but_dont_execute (-n option) to 0 unless -i
(forced_interactive) is supplied at startup. This preserves the
`bash -in <<<INPUT' idiom for testing input sequences but
is closer to the documentation and the intent.
Report from Tom Hale <tom@hale.ee>
+4
View File
@@ -213,3 +213,7 @@
/* Define to 1 if you want posix mode to restrict shell function names to
shell NAMEs. */
/* #define POSIX_RESTRICT_FUNCNAME 0 */
/* Define to 1 to enable a non-recursive list execution implementation. This
replaces recursion with an explicit stack of commands. */
#define NON_RECURSIVE_LISTS 1
Vendored
+12 -12
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.084.
# From configure.ac for Bash 5.4, version 5.085.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for bash 5.3-maint.
# Generated by GNU Autoconf 2.72 for bash 5.4-devel.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -605,8 +605,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.3-maint'
PACKAGE_STRING='bash 5.3-maint'
PACKAGE_VERSION='5.4-devel'
PACKAGE_STRING='bash 5.4-devel'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1468,7 +1468,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures bash 5.3-maint to adapt to many kinds of systems.
'configure' configures bash 5.4-devel to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1534,7 +1534,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.3-maint:";;
short | recursive ) echo "Configuration of bash 5.4-devel:";;
esac
cat <<\_ACEOF
@@ -1742,7 +1742,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.3-maint
bash configure 5.4-devel
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2420,7 +2420,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.3-maint, which was
It was created by bash $as_me 5.4-devel, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3218,8 +3218,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h buildconf.h"
BASHVERS=5.3
RELSTATUS=maint
BASHVERS=5.4
RELSTATUS=devel
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -23943,7 +23943,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.3-maint, which was
This file was extended by bash $as_me 5.4-devel, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24011,7 +24011,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
bash config.status 5.3-maint
bash config.status 5.4-devel
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
+4 -4
View File
@@ -1,5 +1,5 @@
dnl
dnl Configure script for bash-5.3
dnl Configure script for bash-5.4
dnl
dnl report bugs to chet.ramey@case.edu
dnl
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.3, version 5.084])dnl
AC_REVISION([for Bash 5.4, version 5.085])dnl
define(bashvers, 5.3)
define(relstatus, maint)
define(bashvers, 5.4)
define(relstatus, devel)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
+5 -4
View File
@@ -6256,7 +6256,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
rreeaaddoonnllyy allows the value of a variable to be set at the same time
the readonly attribute is changed by following the variable name
with =_v_a_l_u_e. This sets the value of the variable is to _v_a_l_u_e while
with =_v_a_l_u_e. This sets the value of the variable to _v_a_l_u_e while
modifying the readonly attribute.
The return status is 0 unless an invalid option is encountered, one
@@ -6347,8 +6347,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
process group. When a background job completes, the shell
prints a line containing its exit status.
--nn Read commands but do not execute them. This may be used to
check a shell script for syntax errors. This is ignored by
interactive shells.
check a shell script for syntax errors. Interactive shells
ignore this option unless it is supplied at invocation along
with the --ii option (see IINNVVOOCCAATTIIOONN above).
--oo _o_p_t_i_o_n_-_n_a_m_e
The _o_p_t_i_o_n_-_n_a_m_e can be one of the following:
aalllleexxppoorrtt
@@ -7399,4 +7400,4 @@ BBUUGGSS
Array variables may not (yet) be exported.
GNU Bash 5.3 2026 August 14 _B_A_S_H(1)
GNU Bash 5.4 2026 August 20 _B_A_S_H(1)
+29 -22
View File
@@ -5,7 +5,7 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Fri Aug 14 15:49:37 EDT 2026
.\" Last Change: Thu Aug 20 11:41:54 EDT 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 August 14" "GNU Bash 5.3"
.TH BASH 1 "2026 August 20" "GNU Bash 5.4"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -424,7 +424,7 @@ if it exists.
.PP
When an interactive shell that is not a login shell is started,
.B bash
reads and executes commands from
reads and executes commands from
.FN \*~/.bashrc ,
if that file exists.
The
@@ -1014,7 +1014,7 @@ that is executed, or non-zero if any of the expressions is invalid.
.IP
Use the \fBbreak\fP and \fPcontinue\fP builtins
(see
.SM
.SM
.B "SHELL BUILTIN COMMANDS"
below)
to control loop execution.
@@ -3117,7 +3117,7 @@ the number of fractional digits after a decimal point.
A value of 0 causes no decimal point or fraction to be output.
\fBtime\fP prints at most six digits after the decimal point;
values of \fIp\fP greater than 6 are changed to 6.
If \fIp\fP is not specified,
If \fIp\fP is not specified,
\fBtime\fP prints three digits after the decimal point.
.IP
The optional \fBl\fP specifies a longer format, including
@@ -3372,7 +3372,7 @@ If the double-quoted expansion occurs within a word, the expansion of
the first parameter is joined with the beginning part of the
expansion of the original word,
and the expansion of the last parameter is joined with the last
part of the
part of the
expansion of the original word.
This is analogous to the expansion
of the special parameters \fB*\fP and \fB@\fP (see
@@ -4343,7 +4343,7 @@ If
.I expression
is invalid,
.B bash
prints a message to standard error indicating failure,
prints a message to standard error indicating failure,
does not perform the substitution,
and does not
continue to execute the command in which the error occurs.
@@ -6156,7 +6156,7 @@ The shell sends
.B SIGCONT
to stopped jobs to ensure that they receive the
.SM
.B SIGHUP
.B SIGHUP
(see
.SM
.B "JOB CONTROL"
@@ -6771,7 +6771,7 @@ When a command is described as \fIkilling\fP text, the text
deleted is saved for possible future retrieval
(\fIyanking\fP).
The killed text is saved in a \fIkill ring\fP.
Consecutive kills accumulate the deleted text
Consecutive kills accumulate the deleted text
into one unit, which can be yanked all at once.
Commands which do not kill text separate the chunks of text
on the kill ring.
@@ -7350,7 +7350,7 @@ names begin with a
.Q .
(hidden files) when performing filename completion.
If set to \fBOff\fP, the user must include the leading
.Q .
.Q .
in the filename to be completed.
.TP
.B menu\-complete\-display\-prefix (Off)
@@ -7862,12 +7862,12 @@ This performs alias and history expansion,
\fB$\fP\*'\fIstring\fP\*' and \fB$\fP\*"\fIstring\fP\*" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and process substitution,
word splitting, and quote removal
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
An explicit argument suppresses command and process substitution
and quotes each resultant word.
As usual, double-quoting a word will suppress word splitting.
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't
quoted individually.
@@ -8449,7 +8449,7 @@ or if there is no compspec for the command word,
the \fB\-D\fP option to \fBcomplete\fP as the default.
If there is no default compspec, \fBbash\fP performs alias expansion
on the command word as a final resort,
and attempts to find a compspec for the command word
and attempts to find a compspec for the command word
resulting from any successful expansion.
.PP
If a compspec is not found, \fBbash\fP performs its default completion as
@@ -8562,7 +8562,7 @@ External commands that are invoked to generate completions (
.Q "external completers" )
receive the word preceding the completion word as an argument,
as described above.
This provides context that is sometimes useful, but may include
This provides context that is sometimes useful, but may include
information that is considered sensitive or part of a word expansion
that will not appear in the command line after expansion.
That word may be visible in process listings or in audit logs.
@@ -8610,7 +8610,7 @@ to \fBreadline\fP as the list of possible completions.
.PP
If the previously-applied actions do not generate any matches, and the
\fB\-o dirnames\fP option was supplied to \fBcomplete\fP when the
compspec was defined, \fBbash\fP attempts directory name completion.
compspec was defined, \fBbash\fP attempts directory name completion.
.PP
If the \fB\-o plusdirs\fP option was supplied to \fBcomplete\fP when the
compspec was defined, \fBbash\fP attempts directory name completion and
@@ -9544,7 +9544,7 @@ If the
.B \-e
option is supplied with
.BR \-P ,
and \fBcd\fP cannot successfully determine the current working directory
and \fBcd\fP cannot successfully determine the current working directory
after a successful directory change, it returns a non-zero status.
.IP
On systems that support it, the \fB\-@\fP option presents the extended
@@ -11561,9 +11561,9 @@ The
option displays output in a format that may be reused as input.
.IP
\fBreadonly\fP allows the value of a variable to be set at the same time
the readonly attribute is changed by following the variable name with
the readonly attribute is changed by following the variable name with
=\fIvalue\fP.
This sets the value of the variable is to \fIvalue\fP while modifying
This sets the value of the variable to \fIvalue\fP while modifying
the readonly attribute.
.IP
The return status is 0 unless an invalid option is encountered,
@@ -11733,7 +11733,14 @@ containing its exit status.
.B \-n
Read commands but do not execute them.
This may be used to check a shell script for syntax errors.
This is ignored by interactive shells.
Interactive shells ignore this option unless it is
supplied at invocation along with the
.B \-i
option (see
.SM
.B "INVOCATION"
.ie \n(zZ=1 in \fIbash\fP(1)).
.el above).
.TP 8
.B \-o \fIoption\-name\fP
The \fIoption\-name\fP can be one of the following:
@@ -12844,7 +12851,7 @@ in a shell function (see
.B "SHELL GRAMMAR"
.ie \n(zZ=1 in \fIbash\fP(1)).
.el above).
Refer to the description of the \fBextdebug\fP shell option
Refer to the description of the \fBextdebug\fP shell option
(see
.B shopt
.ie \n(zZ=1 in \fIbash\fP(1))
@@ -12938,7 +12945,7 @@ option is used,
either returns the pathname of the executable file
that would be found by searching
.B $PATH
for
for
.I name
or nothing if
.Q "type \-t name"
+90 -89
View File
@@ -1,10 +1,10 @@
This is bash.info, produced by makeinfo version 7.3 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 14 August 2026).
Bash shell (version 5.4, 20 August 2026).
This is Edition 5.3, last updated 14 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
This is Edition 5.4, last updated 20 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.4.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -26,11 +26,11 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 14 August 2026). The Bash home page is
Bash shell (version 5.4, 20 August 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 14 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
This is Edition 5.4, last updated 20 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.4.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -3638,7 +3638,7 @@ standard.
export allows the value of a variable to be set at the same time
it is exported or unexported by following the variable name with
=VALUE. This sets the value of the variable is to VALUE while
=VALUE. This sets the value of the variable to VALUE while
modifying the export attribute.
The return status is zero unless an invalid option is supplied, one
@@ -3763,7 +3763,7 @@ standard.
readonly allows the value of a variable to be set at the same
time the readonly attribute is changed by following the variable
name with =VALUE. This sets the value of the variable is to VALUE
name with =VALUE. This sets the value of the variable to VALUE
while modifying the readonly attribute.
The return status is zero unless an invalid option is supplied, one
@@ -4980,8 +4980,9 @@ parameters, or to display the names and values of shell variables.
-n
Read commands but do not execute them. This may be used to
check a script for syntax errors. This option is ignored by
interactive shells.
check a script for syntax errors. Interactive shells ignore
this option unless it is supplied at invocation along with the
-i option (*note Invoking Bash::).
-o OPTION-NAME
@@ -13857,85 +13858,85 @@ Node: Signals145047
Node: Shell Scripts149995
Node: Shell Builtin Commands153299
Node: Bourne Shell Builtins155640
Node: Bash Builtins182359
Node: Modifying Shell Behavior220094
Node: The Set Builtin220436
Node: The Shopt Builtin232468
Node: Special Builtins250004
Node: Shell Variables250993
Node: Bourne Shell Variables251427
Node: Bash Variables253935
Node: Bash Features293219
Node: Invoking Bash294233
Node: Bash Startup Files301463
Node: Interactive Shells306823
Node: What is an Interactive Shell?307231
Node: Is this Shell Interactive?307893
Node: Interactive Shell Behavior308717
Node: Bash Conditional Expressions312478
Node: Shell Arithmetic317895
Node: Aliases321222
Node: Arrays324356
Node: The Directory Stack332459
Node: Directory Stack Builtins333256
Node: Controlling the Prompt337701
Node: The Restricted Shell340820
Node: Bash POSIX Mode343913
Node: Shell Compatibility Mode363872
Node: Job Control372879
Node: Job Control Basics373336
Node: Job Control Builtins379704
Node: Job Control Variables386492
Node: Command Line Editing387723
Node: Introduction and Notation389426
Node: Readline Interaction391778
Node: Readline Bare Essentials392966
Node: Readline Movement Commands394774
Node: Readline Killing Commands395770
Node: Readline Arguments397793
Node: Searching398883
Node: Readline Init File401126
Node: Readline Init File Syntax402429
Node: Conditional Init Constructs429380
Node: Sample Init File433765
Node: Bindable Readline Commands436885
Node: Commands For Moving438423
Node: Commands For History440887
Node: Commands For Text447044
Node: Commands For Killing451169
Node: Numeric Arguments453957
Node: Commands For Completion455109
Node: Keyboard Macros460805
Node: Miscellaneous Commands461506
Node: Readline vi Mode469049
Node: Programmable Completion470026
Node: Programmable Completion Builtins479762
Node: A Programmable Completion Example491499
Node: Using History Interactively496844
Node: Bash History Facilities497525
Node: Bash History Builtins501260
Node: History Interaction508855
Node: Event Designators513805
Node: Word Designators515383
Node: Modifiers517775
Node: Installing Bash519712
Node: Basic Installation520828
Node: Compilers and Options524704
Node: Compiling For Multiple Architectures525454
Node: Installation Names527207
Node: Specifying the System Type529441
Node: Sharing Defaults530187
Node: Operation Controls530901
Node: Optional Features531920
Node: Reporting Bugs544643
Node: Major Differences From The Bourne Shell546000
Node: GNU Free Documentation License567427
Node: Indexes592604
Node: Builtin Index593055
Node: Reserved Word Index600153
Node: Variable Index602598
Node: Function Index620011
Node: Concept Index634436
Node: Bash Builtins182353
Node: Modifying Shell Behavior220088
Node: The Set Builtin220430
Node: The Shopt Builtin232556
Node: Special Builtins250092
Node: Shell Variables251081
Node: Bourne Shell Variables251515
Node: Bash Variables254023
Node: Bash Features293307
Node: Invoking Bash294321
Node: Bash Startup Files301551
Node: Interactive Shells306911
Node: What is an Interactive Shell?307319
Node: Is this Shell Interactive?307981
Node: Interactive Shell Behavior308805
Node: Bash Conditional Expressions312566
Node: Shell Arithmetic317983
Node: Aliases321310
Node: Arrays324444
Node: The Directory Stack332547
Node: Directory Stack Builtins333344
Node: Controlling the Prompt337789
Node: The Restricted Shell340908
Node: Bash POSIX Mode344001
Node: Shell Compatibility Mode363960
Node: Job Control372967
Node: Job Control Basics373424
Node: Job Control Builtins379792
Node: Job Control Variables386580
Node: Command Line Editing387811
Node: Introduction and Notation389514
Node: Readline Interaction391866
Node: Readline Bare Essentials393054
Node: Readline Movement Commands394862
Node: Readline Killing Commands395858
Node: Readline Arguments397881
Node: Searching398971
Node: Readline Init File401214
Node: Readline Init File Syntax402517
Node: Conditional Init Constructs429468
Node: Sample Init File433853
Node: Bindable Readline Commands436973
Node: Commands For Moving438511
Node: Commands For History440975
Node: Commands For Text447132
Node: Commands For Killing451257
Node: Numeric Arguments454045
Node: Commands For Completion455197
Node: Keyboard Macros460893
Node: Miscellaneous Commands461594
Node: Readline vi Mode469137
Node: Programmable Completion470114
Node: Programmable Completion Builtins479850
Node: A Programmable Completion Example491587
Node: Using History Interactively496932
Node: Bash History Facilities497613
Node: Bash History Builtins501348
Node: History Interaction508943
Node: Event Designators513893
Node: Word Designators515471
Node: Modifiers517863
Node: Installing Bash519800
Node: Basic Installation520916
Node: Compilers and Options524792
Node: Compiling For Multiple Architectures525542
Node: Installation Names527295
Node: Specifying the System Type529529
Node: Sharing Defaults530275
Node: Operation Controls530989
Node: Optional Features532008
Node: Reporting Bugs544731
Node: Major Differences From The Bourne Shell546088
Node: GNU Free Documentation License567515
Node: Indexes592692
Node: Builtin Index593143
Node: Reserved Word Index600241
Node: Variable Index602686
Node: Function Index620099
Node: Concept Index634524

End Tag Table
+90 -89
View File
@@ -2,10 +2,10 @@ This is bashref.info, produced by makeinfo version 7.3 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 14 August 2026).
Bash shell (version 5.4, 20 August 2026).
This is Edition 5.3, last updated 14 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
This is Edition 5.4, last updated 20 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.4.
Copyright © 1988-2026 Free Software Foundation, Inc.
@@ -27,11 +27,11 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 14 August 2026). The Bash home page is
Bash shell (version 5.4, 20 August 2026). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 14 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
This is Edition 5.4, last updated 20 August 2026, of The GNU Bash
Reference Manual, for Bash, Version 5.4.
Bash contains features that appear in other popular shells, and some
features that only appear in Bash. Some of the shells that Bash has
@@ -3639,7 +3639,7 @@ standard.
export allows the value of a variable to be set at the same time
it is exported or unexported by following the variable name with
=VALUE. This sets the value of the variable is to VALUE while
=VALUE. This sets the value of the variable to VALUE while
modifying the export attribute.
The return status is zero unless an invalid option is supplied, one
@@ -3764,7 +3764,7 @@ standard.
readonly allows the value of a variable to be set at the same
time the readonly attribute is changed by following the variable
name with =VALUE. This sets the value of the variable is to VALUE
name with =VALUE. This sets the value of the variable to VALUE
while modifying the readonly attribute.
The return status is zero unless an invalid option is supplied, one
@@ -4981,8 +4981,9 @@ parameters, or to display the names and values of shell variables.
-n
Read commands but do not execute them. This may be used to
check a script for syntax errors. This option is ignored by
interactive shells.
check a script for syntax errors. Interactive shells ignore
this option unless it is supplied at invocation along with the
-i option (*note Invoking Bash::).
-o OPTION-NAME
@@ -13858,85 +13859,85 @@ Node: Signals145197
Node: Shell Scripts150148
Node: Shell Builtin Commands153455
Node: Bourne Shell Builtins155799
Node: Bash Builtins182521
Node: Modifying Shell Behavior220259
Node: The Set Builtin220604
Node: The Shopt Builtin232639
Node: Special Builtins250178
Node: Shell Variables251170
Node: Bourne Shell Variables251607
Node: Bash Variables254118
Node: Bash Features293405
Node: Invoking Bash294422
Node: Bash Startup Files301655
Node: Interactive Shells307018
Node: What is an Interactive Shell?307429
Node: Is this Shell Interactive?308094
Node: Interactive Shell Behavior308921
Node: Bash Conditional Expressions312685
Node: Shell Arithmetic318105
Node: Aliases321435
Node: Arrays324572
Node: The Directory Stack332678
Node: Directory Stack Builtins333478
Node: Controlling the Prompt337926
Node: The Restricted Shell341048
Node: Bash POSIX Mode344144
Node: Shell Compatibility Mode364106
Node: Job Control373116
Node: Job Control Basics373576
Node: Job Control Builtins379947
Node: Job Control Variables386738
Node: Command Line Editing387972
Node: Introduction and Notation389678
Node: Readline Interaction392033
Node: Readline Bare Essentials393224
Node: Readline Movement Commands395035
Node: Readline Killing Commands396034
Node: Readline Arguments398060
Node: Searching399153
Node: Readline Init File401399
Node: Readline Init File Syntax402705
Node: Conditional Init Constructs429659
Node: Sample Init File434047
Node: Bindable Readline Commands437170
Node: Commands For Moving438711
Node: Commands For History441178
Node: Commands For Text447338
Node: Commands For Killing451466
Node: Numeric Arguments454257
Node: Commands For Completion455412
Node: Keyboard Macros461111
Node: Miscellaneous Commands461815
Node: Readline vi Mode469361
Node: Programmable Completion470341
Node: Programmable Completion Builtins480080
Node: A Programmable Completion Example491820
Node: Using History Interactively497168
Node: Bash History Facilities497852
Node: Bash History Builtins501590
Node: History Interaction509188
Node: Event Designators514141
Node: Word Designators515722
Node: Modifiers518117
Node: Installing Bash520057
Node: Basic Installation521176
Node: Compilers and Options525055
Node: Compiling For Multiple Architectures525808
Node: Installation Names527564
Node: Specifying the System Type529801
Node: Sharing Defaults530550
Node: Operation Controls531267
Node: Optional Features532289
Node: Reporting Bugs545015
Node: Major Differences From The Bourne Shell546375
Node: GNU Free Documentation License567805
Node: Indexes592985
Node: Builtin Index593439
Node: Reserved Word Index600540
Node: Variable Index602988
Node: Function Index620404
Node: Concept Index634832
Node: Bash Builtins182515
Node: Modifying Shell Behavior220253
Node: The Set Builtin220598
Node: The Shopt Builtin232727
Node: Special Builtins250266
Node: Shell Variables251258
Node: Bourne Shell Variables251695
Node: Bash Variables254206
Node: Bash Features293493
Node: Invoking Bash294510
Node: Bash Startup Files301743
Node: Interactive Shells307106
Node: What is an Interactive Shell?307517
Node: Is this Shell Interactive?308182
Node: Interactive Shell Behavior309009
Node: Bash Conditional Expressions312773
Node: Shell Arithmetic318193
Node: Aliases321523
Node: Arrays324660
Node: The Directory Stack332766
Node: Directory Stack Builtins333566
Node: Controlling the Prompt338014
Node: The Restricted Shell341136
Node: Bash POSIX Mode344232
Node: Shell Compatibility Mode364194
Node: Job Control373204
Node: Job Control Basics373664
Node: Job Control Builtins380035
Node: Job Control Variables386826
Node: Command Line Editing388060
Node: Introduction and Notation389766
Node: Readline Interaction392121
Node: Readline Bare Essentials393312
Node: Readline Movement Commands395123
Node: Readline Killing Commands396122
Node: Readline Arguments398148
Node: Searching399241
Node: Readline Init File401487
Node: Readline Init File Syntax402793
Node: Conditional Init Constructs429747
Node: Sample Init File434135
Node: Bindable Readline Commands437258
Node: Commands For Moving438799
Node: Commands For History441266
Node: Commands For Text447426
Node: Commands For Killing451554
Node: Numeric Arguments454345
Node: Commands For Completion455500
Node: Keyboard Macros461199
Node: Miscellaneous Commands461903
Node: Readline vi Mode469449
Node: Programmable Completion470429
Node: Programmable Completion Builtins480168
Node: A Programmable Completion Example491908
Node: Using History Interactively497256
Node: Bash History Facilities497940
Node: Bash History Builtins501678
Node: History Interaction509276
Node: Event Designators514229
Node: Word Designators515810
Node: Modifiers518205
Node: Installing Bash520145
Node: Basic Installation521264
Node: Compilers and Options525143
Node: Compiling For Multiple Architectures525896
Node: Installation Names527652
Node: Specifying the System Type529889
Node: Sharing Defaults530638
Node: Operation Controls531355
Node: Optional Features532377
Node: Reporting Bugs545103
Node: Major Differences From The Bourne Shell546463
Node: GNU Free Documentation License567893
Node: Indexes593073
Node: Builtin Index593527
Node: Reserved Word Index600628
Node: Variable Index603076
Node: Function Index620492
Node: Concept Index634920

End Tag Table
+116 -113
View File
@@ -116,7 +116,7 @@ Bash is the shell, or command language interpreter,
for the @sc{gnu} operating system.
The name is an acronym for the @samp{Bourne-Again SHell},
a pun on Stephen Bourne, the author of the direct ancestor of
the current Unix shell @code{sh},
the current Unix shell @code{sh},
which appeared in the Seventh Edition Bell Labs Research version
of Unix.
@@ -146,7 +146,7 @@ As a command interpreter, the shell provides the user
interface to the rich set of @sc{gnu} utilities.
The programming language features allow these utilities to be combined.
Users can create files containing commands, and these become
commands themselves.
commands themselves.
These new commands have the same status as
system commands in directories such as @file{/bin}, allowing users
or groups to establish custom environments to automate their common
@@ -179,12 +179,12 @@ but they are more convenient to use as builtin commands.
All of the shell builtins are described in subsequent sections.
While executing commands is essential, most of the power (and
complexity) of shells is due to their embedded programming languages.
complexity) of shells is due to their embedded programming languages.
Like any high-level language, the shell provides variables,
flow control constructs, quoting, and functions.
flow control constructs, quoting, and functions.
Shells offer features geared specifically for
interactive use rather than to augment the programming language.
interactive use rather than to augment the programming language.
These interactive features include job control, command line
editing, command history and aliases.
This manual describes how Bash provides all of these features.
@@ -199,7 +199,7 @@ These definitions are used throughout the remainder of this manual.
@cindex POSIX
A family of open system standards based on Unix. Bash
is primarily concerned with the Shell and Utilities portion of the
@sc{posix} 1003.1 standard.
@sc{posix} 1003.1 standard.
@item blank
A space or tab character.
@@ -349,7 +349,7 @@ When the shell reads input, it proceeds through a
sequence of operations. If the input indicates the beginning of a
comment, the shell ignores the comment symbol (@samp{#}), and the rest
of that line.
Otherwise, roughly speaking, the shell reads its input and
divides the input into words and operators, employing the quoting rules
to select which meanings to assign various words and characters.
@@ -557,7 +557,7 @@ been present.
Prefixing a double-quoted string with a dollar sign (@samp{$}), such
as @verb{|$"hello, world"|},
causes the string to be translated according to the current locale.
The @code{gettext} infrastructure performs the lookup and
The @code{gettext} infrastructure performs the lookup and
translation, using the @code{LC_MESSAGES}, @code{TEXTDOMAINDIR},
and @code{TEXTDOMAIN} shell variables, as explained below.
See the gettext documentation for additional details not covered here.
@@ -635,7 +635,7 @@ to produce the corresponding MO file.
Once you have the MO files, you decide where to install them and use the
@code{TEXTDOMAINDIR} shell variable to tell the gettext tools where they are.
Make sure to use the same message domain to name the MO files
Make sure to use the same message domain to name the MO files
as you did for the PO files when you install them.
@vindex LANG
@@ -918,7 +918,7 @@ the standard input for asynchronous commands,
in the absence of any explicit redirections involving the standard input,
is redirected from @file{/dev/null}.
Commands separated or terminated by
Commands separated or terminated by
@samp{;} (or equivalent @code{newline})
are executed sequentially; the shell waits for each
command to terminate in turn.
@@ -1016,7 +1016,7 @@ for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) [;] do @var{commands} ; done
First, evaluate the arithmetic expression @var{expr1} according
to the rules described below (@pxref{Shell Arithmetic}).
Then, repeatedly evaluate the arithmetic expression @var{expr2}
until it evaluates to zero.
until it evaluates to zero.
Each time @var{expr2} evaluates to a non-zero value, execute @var{commands}
and evaluate the arithmetic expression @var{expr3}.
If any expression is omitted, it behaves as if it evaluates to 1.
@@ -1054,7 +1054,7 @@ The @var{test-commands} list is executed, and if its return status is zero,
the @var{consequent-commands} list is executed.
If @var{test-commands} returns a non-zero status, each @code{elif} list
is executed in turn, and if its exit status is zero,
the corresponding @var{more-consequents} is executed and the
the corresponding @var{more-consequents} is executed and the
command completes.
If @samp{else @var{alternate-consequents}} is present, and
the final command in the final @code{if} or @code{elif} clause
@@ -1130,7 +1130,7 @@ in the next clause, if any, and execute any associated @var{command-list}
if the match succeeds,
continuing the case statement execution as if the pattern list had not matched.
The return status is zero if no @var{pattern} matches.
The return status is zero if no @var{pattern} matches.
Otherwise, the return status is the exit status of the
last @var{command-list} executed.
@@ -1189,7 +1189,7 @@ specially and are removed.
Since this can potentially result in empty strings,
this command treats those as expressions that evaluate to 0.
If the value of the expression is non-zero, the return status is 0;
otherwise the return status is 1.
otherwise the return status is 1.
@item [[@dots{}]]
@rwindex [[
@@ -1259,7 +1259,7 @@ operators.
For example, the following will match a line
(stored in the shell variable @code{line})
if there is a sequence of characters anywhere in the value consisting of
any number, including zero, of
any number, including zero, of
characters in the @code{space} character class,
immediately followed by zero or one instances of @samp{a},
then a @samp{b}:
@@ -1438,7 +1438,7 @@ Placing a list of commands between parentheses forces the shell to create
a subshell (@pxref{Command Execution Environment}), and each
of the commands in @var{list} is executed in that subshell environment.
Since the @var{list} is executed in a subshell, variable assignments do not
remain in effect after the subshell completes.
remain in effect after the subshell completes.
@item @{@}
@rwindex @{
@@ -1739,7 +1739,7 @@ func1
@end example
The @code{unset} builtin also acts using the same dynamic scope: if a
variable is local to the current scope, @code{unset} unsets it;
variable is local to the current scope, @code{unset} unsets it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it remains so
@@ -1808,12 +1808,12 @@ All @var{value}s undergo tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote
removal (@pxref{Shell Parameter Expansion}).
If the variable has its @code{integer}
attribute set, then @var{value}
attribute set, then @var{value}
is evaluated as an arithmetic expression even if the @code{$((@dots{}))}
expansion is not used (@pxref{Arithmetic Expansion}).
Word splitting and filename expansion are not performed.
Assignment statements may also appear as arguments to the
@code{alias},
@code{alias},
@code{declare}, @code{typeset}, @code{export}, @code{readonly},
and @code{local} builtin commands (@dfn{declaration commands}).
When in @sc{posix} mode (@pxref{Bash POSIX Mode}), these builtins may appear
@@ -1824,7 +1824,7 @@ For example,
command export var=value
@end example
In the context where an assignment statement is assigning a value
In the context where an assignment statement is assigning a value
to a shell variable or array index (@pxref{Arrays}), the
@samp{+=} operator appends to or adds to
the variable's previous value.
@@ -2607,7 +2607,7 @@ key expands to a separate word.
Substitutes the length in characters of the value of @var{parameter}.
If @var{parameter} is @samp{*} or @samp{@@}, the value substituted
is the number of positional parameters.
If @var{parameter} is an array name subscripted by @samp{*} or @samp{@@},
If @var{parameter} is an array name subscripted by @samp{*} or @samp{@@},
the value substituted is the number of elements in the array.
If @var{parameter}
is an indexed array name subscripted by a negative number, that number is
@@ -2654,10 +2654,10 @@ is an array variable subscripted with @samp{@@} or @samp{*},
the pattern removal operation is applied to each member of the
array in turn, and the expansion is the resultant list.
@item $@{@var{parameter}/@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/#@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/%@var{pattern}/@var{string}@}
@item $@{@var{parameter}/@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/#@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/%@var{pattern}/@var{string}@}
The @var{pattern} is expanded to produce a pattern
and matched against the expanded value of @var{parameter}
as described below (@pxref{Pattern Matching}).
@@ -2748,9 +2748,9 @@ will both output @samp{\abcxyzdef}.
It should rarely be necessary to enclose only @var{string} in double
quotes.
If the @code{nocasematch} shell option
If the @code{nocasematch} shell option
(see the description of @code{shopt} in @ref{The Shopt Builtin})
is enabled, the match is performed without regard to the case
is enabled, the match is performed without regard to the case
of alphabetic characters.
If @var{parameter} is @samp{@@} or @samp{*},
@@ -2881,7 +2881,7 @@ replaced by the equivalent but faster @code{$(< @var{file})}.
With the old-style backquote form of substitution,
backslash retains its literal meaning except when followed by
@samp{$}, @samp{`}, or @samp{\}.
@samp{$}, @samp{`}, or @samp{\}.
The first backquote not preceded by a backslash terminates the
command substitution.
When using the @code{$(@var{command})} form, all characters between
@@ -2907,7 +2907,7 @@ the word without being followed by a shell metacharacter as a reserved
word would usually require.
Any side effects of @var{command} take effect immediately
in the current execution environment and persist in the current
in the current execution environment and persist in the current
environment after the command completes (e.g., the @code{exit} builtin
exits the shell).
@@ -2990,7 +2990,7 @@ Since the way Bash handles double quotes
can potentially result in empty strings,
arithmetic expansion treats
those as expressions that evaluate to 0.
Arithmetic expansions may be nested.
Arithmetic expansions may be nested.
The evaluation is performed according to the rules listed below
(@pxref{Shell Arithmetic}).
@@ -3006,7 +3006,7 @@ continue to execute the command in which the error occurs.
Process substitution allows a process's input or output to be
referred to using a filename.
It takes the form of
It takes the form of
@example
<(@var{list})
@end example
@@ -3018,7 +3018,7 @@ or
@noindent
The process @var{list},
as long as it is not a null command without redirections,
is run asynchronously, and its input or output
is run asynchronously, and its input or output
appears as a filename.
This filename is
passed as an argument to the current command as the result of the
@@ -3028,7 +3028,7 @@ If the
@code{>(@var{list})} form is used, writing to the file
provides input for @var{list}.
If the
@code{<(@var{list})} form is used, reading the file
@code{<(@var{list})} form is used, reading the file
obtains the output of @var{list}.
Note that no space may appear between the @code{<} or @code{>}
and the left parenthesis, otherwise the construct would be interpreted
@@ -3321,7 +3321,7 @@ If the @code{globskipdots}
shell option is enabled, the filenames
@file{.} and @file{..}
never appear in the set.
As above, @samp{.} only has a special meaning when matching filenames.
As above, @samp{.} only has a special meaning when matching filenames.
Complicated extended pattern matching against long strings is slow,
especially when the patterns contain alternations and the strings
@@ -3437,7 +3437,7 @@ the corresponding TCP socket.
@item /dev/udp/@var{host}/@var{port}
If @var{host} is a valid hostname or Internet address, and @var{port}
is an integer port number or service name, Bash attempts to open
is an integer port number or service name, Bash attempts to open
the corresponding UDP socket.
@end table
@@ -4111,7 +4111,7 @@ itself (scenario 1 above), for compatibility.
A @dfn{shell script} is a text file containing shell commands.
When such a file is used as the first non-option argument when
invoking Bash, and neither the @option{-c} nor @option{-s} option
is supplied (@pxref{Invoking Bash}),
is supplied (@pxref{Invoking Bash}),
Bash reads and executes commands from the file, then exits.
This mode of operation creates a non-interactive shell.
If the filename does not contain any slashes, the shell first searches
@@ -4232,7 +4232,7 @@ All builtins except
@code{:}, @code{true}, @code{false}, @code{echo}, and @code{test}/@code{[}
accept @samp{--help} as a special option.
If @samp{--help} is supplied, these builtins output
a help message and exit with a status of 0.
a help message and exit with a status of 0.
@node Bourne Shell Builtins
@section Bourne Shell Builtins
@@ -4337,11 +4337,11 @@ component.
If it is not a valid directory name, @code{cd} returns a non-zero status.
If the @option{-e} option is supplied with @option{-P}
and @code{cd} cannot successfully determine the current working directory
and @code{cd} cannot successfully determine the current working directory
after a successful directory change, it returns a non-zero status.
On systems that support it, the @option{-@@} option presents the extended
attributes associated with a file as a directory.
attributes associated with a file as a directory.
If @var{directory} is @samp{-}, it is converted to @env{$OLDPWD}
before attempting the directory change.
@@ -4448,7 +4448,7 @@ The @option{-p} option displays output in a form that may be reused as input.
@code{export} allows the value of a variable to be set at the same time
it is exported or unexported by following the variable name with
=@var{value}.
This sets the value of the variable is to @var{value} while modifying
This sets the value of the variable to @var{value} while modifying
the export attribute.
The return status is zero unless an invalid option is supplied, one of
@@ -4609,7 +4609,7 @@ option displays output in a format that may be reused as input.
@code{readonly} allows the value of a variable to be set at the same time
the readonly attribute is changed by following the variable name with
=@var{value}.
This sets the value of the variable is to @var{value} while modifying
This sets the value of the variable to @var{value} while modifying
the readonly attribute.
The return status is zero unless an invalid option is supplied, one of
@@ -4856,7 +4856,7 @@ If a @var{sigspec} is @code{RETURN}, @var{action} is executed
each time a shell function or a script executed with the @code{.} or
@code{source} builtins finishes executing.
If a @var{sigspec} is @code{ERR}, @var{action}
If a @var{sigspec} is @code{ERR}, @var{action}
is executed whenever
a pipeline (which may consist of a single simple
command), a list, or a compound command returns a
@@ -4903,7 +4903,7 @@ Set the shell process's file creation mask to @var{mode}.
If @var{mode} begins with a digit, it is interpreted as an octal number;
if not, it is interpreted as a symbolic mode mask similar
to that accepted by the @code{chmod} command.
If @var{mode} is omitted, @code{umask} prints the current value of the mask.
If @var{mode} is omitted, @code{umask} prints the current value of the mask.
If the @option{-S}
option is supplied without a @var{mode} argument, @code{umask}
prints the mask in a symbolic format;
@@ -5172,7 +5172,7 @@ declare [-aAfFgiIlnrtux] [-p] [@var{name}[=@var{value}] @dots{}]
Declare variables and give them attributes.
If no @var{name}s are given, then display the values of variables or
shell functions instead.
shell functions instead.
The @option{-p} option will display the attributes and values of each
@var{name}.
@@ -5267,7 +5267,7 @@ as with the @code{local} command, unless the @option{-g} option is supplied.
If a variable name is followed by =@var{value}, the value of the variable
is set to @var{value}.
When using @option{-a} or @option{-A} and the compound assignment syntax to
When using @option{-a} or @option{-A} and the compound assignment syntax to
create array variables, additional attributes do not take effect until
subsequent assignments.
@@ -5318,7 +5318,7 @@ form feed
new line
@item \r
carriage return
@item \t
@item \t
horizontal tab
@item \v
vertical tab
@@ -5362,7 +5362,7 @@ supplied, print a list of shell builtins.
With no other arguments, the list consists of all enabled shell builtins.
The @option{-n} option means to print only disabled builtins.
The @option{-a} option means to list
each builtin with an indication of whether or not it is enabled.
each builtin with an indication of whether or not it is enabled.
The @option{-s} option means to
restrict @code{enable} to the
@sc{posix}
@@ -5422,7 +5422,7 @@ If not, and @var{pattern} exactly matches the name of a help topic,
@code{help} prints the description
associated with that topic.
Otherwise, @code{help} performs prefix matching and
prints the descriptions of all matching help topics.
prints the descriptions of all matching help topics.
The return status is zero unless no command matches @var{pattern}.
@@ -5432,7 +5432,7 @@ The return status is zero unless no command matches @var{pattern}.
let @var{expression} [@var{expression} @dots{}]
@end example
The @code{let} builtin allows arithmetic to be performed on shell variables.
The @code{let} builtin allows arithmetic to be performed on shell variables.
Each @var{expression} is evaluated as an arithmetic expression
according to the rules given below in @ref{Shell Arithmetic}.
If the last @var{expression} evaluates to 0,
@@ -5583,7 +5583,7 @@ This is an exception to the usual @code{printf} behavior.
@noindent
The %b, %q, and %T format specifiers all use the field width and precision
arguments from the format specification and write that many bytes from
arguments from the format specification and write that many bytes from
(or use that wide a field for) the expanded argument, which usually
contains more characters than the original.
@@ -5596,7 +5596,7 @@ any supplied field width and precision in terms of characters, not bytes.
The %S and %C format specifiers are equivalent to %ls and %lc, respectively.
@ignore
The %s format specifier understands the "altform" flag (#) and behaves
The %s format specifier understands the "altform" flag (#) and behaves
identically to the %b format specifier if it's supplied.
@end ignore
@@ -5963,7 +5963,7 @@ Aliases are described in @ref{Aliases}.
@node Modifying Shell Behavior
@section Modifying Shell Behavior
@menu
* The Set Builtin:: Change the values of shell attributes and
positional parameters.
@@ -6068,7 +6068,10 @@ containing its exit status.
@item -n
Read commands but do not execute them.
This may be used to check a script for syntax errors.
This option is ignored by interactive shells.
Interactive shells ignore this option unless it is
supplied at invocation along with the
@option{-i}
option (@pxref{Invoking Bash}).
@item -o @var{option-name}
@@ -6361,7 +6364,7 @@ builtins that can perform variable assignments,
and while executing builtins that perform array dereferencing.
@item assoc_expand_once
Deprecated; a synonym for @code{array_expand_once}.
Deprecated; a synonym for @code{array_expand_once}.
@item autocd
If set, a command name that is the name of a directory is executed as if
@@ -6402,7 +6405,7 @@ The shell always postpones exiting if any jobs are stopped.
@item checkwinsize
If set, Bash checks the window size after each external (non-builtin)
command and, if necessary, updates the values of
command and, if necessary, updates the values of
@env{LINES} and @env{COLUMNS},
using the file descriptor associated with stderr if it is a terminal.
This option is enabled by default.
@@ -6451,7 +6454,7 @@ If not set, Bash attempts to preserve what the user typed.
@item dirspell
If set, Bash
attempts spelling correction on directory names during word completion
attempts spelling correction on directory names during word completion
if the directory name initially supplied does not exist.
@item dotglob
@@ -6513,10 +6516,10 @@ If set, enable the extended pattern matching features described above
(@pxref{Pattern Matching}).
@item extquote
If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is
performed within @code{$@{@var{parameter}@}} expansions
If set, @code{$'@var{string}'} and @code{$"@var{string}"} quoting is
performed within @code{$@{@var{parameter}@}} expansions
enclosed in double quotes.
This option is enabled by default.
This option is enabled by default.
@item failglob
If set, patterns which fail to match filenames during filename expansion
@@ -6537,7 +6540,7 @@ comparisons.
That is, pattern matching does not take
the current locale's collating sequence into account,
so @samp{b} will not collate between @samp{A} and @samp{B},
and upper-case and lower-case ASCII characters will collate together.
and upper-case and lower-case ASCII characters will collate together.
@item globskipdots
If set, filename expansion will never match the filenames
@@ -6739,7 +6742,7 @@ environment after the command completes.
When Bash is not executing in @sc{posix} mode, these builtins behave no
differently than the rest of the Bash builtin commands.
The Bash @sc{posix} mode is described in @ref{Bash POSIX Mode}.
The Bash @sc{posix} mode is described in @ref{Bash POSIX Mode}.
These are the @sc{posix} special builtins:
@example
@@ -6850,7 +6853,7 @@ At shell startup, $_ set to the pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, it expands to the last argument to the previous simple
command executed in the foreground, after expansion.
command executed in the foreground, after expansion.
It is also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, $_ expands to the name of the mail file.
@@ -6989,7 +6992,7 @@ where each corresponding member of @env{FUNCNAME} was invoked.
@code{$@{BASH_LINENO[$i]@}} is the line number in the source file
(@code{$@{BASH_SOURCE[$i+1]@}}) where
@code{$@{FUNCNAME[$i]@}} was called (or @code{$@{BASH_LINENO[$i-1]@}} if
referenced within another shell function).
referenced within another shell function).
Use @code{LINENO} to obtain the current line number.
Assignments to @env{BASH_LINENO} have no effect, and it may not be unset.
@@ -7226,7 +7229,7 @@ commands.
Full pathnames in the command hash table are not subject to @code{EXECIGNORE}.
Use this variable to ignore shared library files that have the executable
bit set, but are not executable files.
The pattern matching honors the setting of the @code{extglob} shell
The pattern matching honors the setting of the @code{extglob} shell
option.
@item FCEDIT
@@ -7235,7 +7238,7 @@ The editor used as a default by the @code{fc} builtin command.
@item FIGNORE
A colon-separated list of suffixes to ignore when performing
filename completion.
A filename whose suffix matches one of the entries in
A filename whose suffix matches one of the entries in
@env{FIGNORE}
is excluded from the list of matched filenames.
A sample value is
@@ -7333,7 +7336,7 @@ and a value of @samp{-} sorts by name in descending order.
Any invalid value restores the historical sorting behavior.
@item GROUPS
An array variable containing the list of groups of which the current
An array variable containing the list of groups of which the current
user is a member.
Assignments to @env{GROUPS} have no effect.
If @env{GROUPS}
@@ -7388,7 +7391,7 @@ current line to be removed from the history list before that line
is saved.
Any value not in the above list is ignored.
If @env{HISTCONTROL} is unset, or does not include a valid value,
Bash saves all lines read by the shell parser on the history list,
Bash saves all lines read by the shell parser on the history list,
subject to the value of @env{HISTIGNORE}.
If the first line of a multi-line compound command was saved,
the second and subsequent lines are not tested,
@@ -7451,9 +7454,9 @@ option.
@env{HISTIGNORE} subsumes some of the function of @env{HISTCONTROL}.
A pattern of @samp{&} is identical to @code{ignoredups}, and a
pattern of @samp{[ ]*} is identical to @code{ignorespace}.
pattern of @samp{[ ]*} is identical to @code{ignorespace}.
Combining these two patterns, separating them with a colon,
provides the functionality of @code{ignoreboth}.
provides the functionality of @code{ignoreboth}.
@item HISTSIZE
The maximum number of commands to remember on the history list.
@@ -7481,7 +7484,7 @@ value is changed, Bash adds the contents of the new file to the
existing list.
If @env{HOSTFILE}
is set, but has no value, or does not name a readable file,
Bash attempts to read
Bash attempts to read
@file{/etc/hosts}
to obtain the list of possible hostname completions.
When @env{HOSTFILE} is unset,
@@ -7501,7 +7504,7 @@ of consecutive @code{EOF} characters that can be read as the
first character on an input line before Bash exits.
If the variable is set but does not have a numeric value,
or the value is null, then the default is 10.
If the variable is unset, then @code{EOF} signifies the end of
If the variable is unset, then @code{EOF} signifies the end of
input to the shell.
This is only in effect for interactive shells.
@@ -7514,7 +7517,7 @@ If Bash finds this variable in the environment when the shell
starts, it assumes that the shell is running in an Emacs shell buffer
and may disable line editing depending on the value of @env{TERM}.
@item LANG
@item LANG
Used to determine the locale category for any category not specifically
selected with a variable starting with @code{LC_}.
@@ -7702,7 +7705,7 @@ set to the line read when @code{read} is not supplied a variable name
argument.
@item SECONDS
This variable expands to the number of seconds since the shell was started.
This variable expands to the number of seconds since the shell was started.
Assignment to this variable resets the count to the value assigned, and the
expanded value becomes the value assigned plus the number of seconds
since the assignment.
@@ -7754,7 +7757,7 @@ The @samp{%} character introduces an
escape sequence that is expanded to a time value or other
information.
The escape sequences and their meanings are as
follows; the brackets denote optional portions.
follows; the brackets denote optional portions.
@table @code
@@ -7762,16 +7765,16 @@ follows; the brackets denote optional portions.
A literal @samp{%}.
@item %[@var{p}][l]R
The elapsed time in seconds.
The elapsed time in seconds.
@item %[@var{p}][l]U
The number of CPU seconds spent in user mode.
The number of CPU seconds spent in user mode.
@item %[@var{p}][l]S
The number of CPU seconds spent in system mode.
The number of CPU seconds spent in system mode.
@item %P
The CPU percentage, computed as (%U + %S) / %R.
The CPU percentage, computed as (%U + %S) / %R.
@end table
The optional @var{p} is a digit specifying the precision, the number of
@@ -7784,7 +7787,7 @@ If @var{p} is not specified,
The optional @code{l} specifies a longer format, including minutes, of
the form @var{MM}m@var{SS}.@var{FF}s.
The value of @var{p} determines whether or not the fraction is included.
The value of @var{p} determines whether or not the fraction is included.
If this variable is not set, Bash acts as if it had the value
@example
@@ -7857,7 +7860,7 @@ All of the single-character options used with the @code{set} builtin
In addition, there are several multi-character
options that you can use.
These options must appear on the command
line before the single-character options to be recognized.
line before the single-character options to be recognized.
@table @code
@item --debugger
@@ -7930,7 +7933,7 @@ invocation which are not available with the @code{set} builtin.
@table @code
@item -c
Read and execute commands from the first non-option argument
@var{command_string}, then exit.
@var{command_string}, then exit.
If there are arguments after the @var{command_string},
the first argument is assigned to @code{$0}
and any remaining arguments are assigned to the positional parameters.
@@ -7974,7 +7977,7 @@ This implies the @option{-n} option; no commands will be executed.
@var{shopt_option} is one of the shell options accepted by the
@code{shopt} builtin (@pxref{The Shopt Builtin}).
If @var{shopt_option} is present, @option{-O} sets the value of that option;
@option{+O} unsets it.
@option{+O} unsets it.
If @var{shopt_option} is not supplied, Bash
prints the names and values of the shell
options accepted by @code{shopt} on the standard output.
@@ -8022,7 +8025,7 @@ the name of a file containing shell commands (@pxref{Shell Scripts}).
When Bash is invoked in this fashion, @code{$0}
is set to the name of the file, and the positional parameters
are set to the remaining arguments.
Bash reads and executes commands from this file, then exits.
Bash reads and executes commands from this file, then exits.
Bash's exit status is the exit status of the last command executed
in the script.
If no commands are executed, the exit status is 0.
@@ -8121,7 +8124,7 @@ filename.
As noted above, if a non-interactive shell is invoked with the
@option{--login} option,
Bash attempts to read and execute commands from the
login shell startup files.
login shell startup files.
@subsubheading Invoked with name @code{sh}
@@ -8533,7 +8536,7 @@ True if @var{string1} sorts before @var{string2} lexicographically.
True if @var{string1} sorts after @var{string2} lexicographically.
@item @var{arg1} OP @var{arg2}
@code{OP} is one of
@code{OP} is one of
@samp{-eq}, @samp{-ne}, @samp{-lt}, @samp{-le}, @samp{-gt}, or @samp{-ge}.
These arithmetic binary operators return true if @var{arg1}
is equal to, not equal to, less than, less than or equal to,
@@ -8571,7 +8574,7 @@ The operators and their precedence, associativity, and values
are the same as in the C language.
The following list of operators is grouped into levels of
equal-precedence operators.
The levels are listed in order of decreasing precedence.
The levels are listed in order of decreasing precedence.
@table @code
@cindex arithmetic operators
@@ -8581,7 +8584,7 @@ The levels are listed in order of decreasing precedence.
@cindex bitwise arithmetic operators
@item @var{id}++ @var{id}--
variable post-increment and post-decrement
variable post-increment and post-decrement
@item ++@var{id} --@var{id}
variable pre-increment and pre-decrement
@@ -8636,7 +8639,7 @@ comma
@end table
Shell variables are allowed as operands; parameter expansion is
performed before the expression is evaluated.
performed before the expression is evaluated.
Within an expression, shell variables may also be referenced by name
without using the parameter expansion syntax.
This means you can use @var{x},
@@ -8647,7 +8650,7 @@ 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
when it is referenced, or when a variable which has been given the
when it is referenced, or when a variable which has been given the
@code{integer} attribute using @samp{declare -i} is assigned a value.
A null value evaluates to 0.
A shell variable need not have its @code{integer} attribute enabled
@@ -8690,7 +8693,7 @@ If it matches, the shell
replaces the word with the alias value, and reads that value as if it
had been read instead of the word.
The shell doesn't look at any characters following the word before
attempting alias substitution.
attempting alias substitution.
The characters @samp{/}, @samp{$}, @samp{`}, @samp{=} and any of the
shell metacharacters or quoting characters listed above may not appear
@@ -8901,12 +8904,12 @@ expansion of the original word,
and the expansion of the last parameter is joined with the last part of the
expansion of the original word.
This is analogous to the
expansion of the special parameters @samp{@@} and @samp{*}.
expansion of the special parameters @samp{@@} and @samp{*}.
@code{$@{#@var{name}[@var{subscript}]@}} expands to the length of
@code{$@{@var{name}[@var{subscript}]@}}.
If @var{subscript} is @samp{@@} or @samp{*},
the expansion is the number of elements in the array.
the expansion is the number of elements in the array.
If the @var{subscript}
used to reference an element of an indexed array
@@ -9637,7 +9640,7 @@ falling back to physical mode.
@item
When the @code{cd} builtin cannot change a directory because the
length of the pathname
length of the pathname
constructed from @code{$PWD} and the directory name supplied as an argument
exceeds @code{PATH_MAX} when canonicalized, @code{cd} will
attempt to use the supplied directory name.
@@ -9841,7 +9844,7 @@ This section does not mention behavior that is standard for a particular
version (e.g., setting @code{compat32} means that quoting the right hand
side of the regexp
matching operator quotes special regexp characters in the word, which is
default behavior in bash-3.2 and subsequent versions).
default behavior in bash-3.2 and subsequent versions).
If a user enables, say, @code{compat32}, it may affect the behavior of other
compatibility levels up to and including the current compatibility level.
@@ -10095,7 +10098,7 @@ of the last process in the pipeline associated with this job is
25647.
All of the processes in a single pipeline are members of
the same job.
Bash uses the @var{job} abstraction as the basis for job control.
Bash uses the @var{job} abstraction as the basis for job control.
To facilitate the implementation of the user interface to job control,
each process has a @dfn{process group @sc{id}}, and
@@ -10108,7 +10111,7 @@ Processes that have the same process group ID are said to be part of
the same @dfn{process group}.
Members of the foreground process group (processes whose
process group @sc{id} is equal to the current terminal process group
@sc{id}) receive keyboard-generated signals such as @code{SIGINT}.
@sc{id}) receive keyboard-generated signals such as @code{SIGINT}.
Processes in the foreground process group are said to be
foreground processes.
Background processes
@@ -10124,7 +10127,7 @@ The system sends a
signal to background processes which attempt to
read from (write to when @code{tostop} is in effect)
the terminal,
which, unless caught, suspends the process.
which, unless caught, suspends the process.
If the operating system on which Bash is running supports
job control, Bash contains facilities to use it.
@@ -10179,7 +10182,7 @@ If there is only a single job, @samp{%+} and @samp{%-} can both be used
to refer to that job.
In output pertaining to jobs (e.g., the output of the @code{jobs}
command), the current job is always marked with a @samp{+}, and the
previous job with a @samp{-}.
previous job with a @samp{-}.
Simply naming a job can be used to bring it into the foreground:
@samp{%1} is a synonym for @samp{fg %1}, bringing job 1 from the
@@ -10187,7 +10190,7 @@ background into the foreground.
Similarly, @samp{%1 &} resumes
job 1 in the background, equivalent to @samp{bg %1}.
The shell learns immediately whenever a job changes state.
The shell learns immediately whenever a job changes state.
Normally, Bash waits until it is about to print a prompt before
notifying the user about
changes in a job's status so as to not interrupt
@@ -10286,7 +10289,7 @@ Display only stopped jobs.
@end table
If @var{jobspec} is supplied,
@code{jobs} restricts output to information about that job.
@code{jobs} restricts output to information about that job.
If @var{jobspec} is not supplied, @code{jobs} lists the status of all jobs.
The return status is zero unless an invalid option is encountered
or an invalid
@@ -10296,7 +10299,7 @@ is supplied.
If the @option{-x} option is supplied, @code{jobs} replaces any
@var{jobspec} found in @var{command} or @var{arguments} with the
corresponding process group @sc{id}, and executes @var{command},
passing it @var{argument}s, returning its exit status.
passing it @var{argument}s, returning its exit status.
@item kill
@btindex kill
@@ -10546,18 +10549,18 @@ each directory of the package (the top directory, the
@file{builtins}, @file{doc}, @file{po}, and @file{support} directories,
each directory under @file{lib}, and several others).
It also creates a
@file{config.h} file containing system-dependent definitions.
@file{config.h} file containing system-dependent definitions.
Finally, it creates a shell script named @code{config.status} that you
can run in the future to recreate the current configuration, a
file @file{config.cache} that saves the results of its tests to
speed up reconfiguring, and a file @file{config.log} containing
compiler output (useful mainly for debugging @code{configure}).
compiler output (useful mainly for debugging @code{configure}).
If at some point
@file{config.cache} contains results you don't want to keep, you
may remove or edit it.
may remove or edit it.
To find out more about the options and arguments that the
@code{configure} script understands, type
@code{configure} script understands, type
@example
bash-4.2$ ./configure --help
@@ -10681,7 +10684,7 @@ The @env{prefix} variable provides a default for @env{exec_prefix} and
other variables used when installing Bash.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.
architecture-specific files and architecture-independent files.
If you give @code{configure} the option
@option{--exec-prefix=@var{PATH}}, @samp{make install} will use
@var{PATH} as the prefix for installing programs and libraries.
@@ -10730,7 +10733,7 @@ or a canonical name with three fields: @samp{CPU-COMPANY-SYSTEM}
(e.g., @samp{i386-unknown-freebsd4.2}).
See the file @file{support/config.sub} for the possible
values of each field.
values of each field.
@node Sharing Defaults
@section Sharing Defaults
@@ -10760,7 +10763,7 @@ operates.
Use and save the results of the tests in
@var{file} instead of @file{./config.cache}.
Set @var{file} to @file{/dev/null} to disable caching,
for debugging @code{configure}.
for debugging @code{configure}.
@item --help
Print a summary of the options to @code{configure}, and exit.
@@ -10796,7 +10799,7 @@ To configure Bash without a feature
that is enabled by default, use @option{--disable-@var{feature}}.
Here is a complete list of the @option{--enable-} and @option{--with-}
options that the Bash @code{configure} recognizes.
options that the Bash @code{configure} recognizes.
@table @code
@item --with-afs
@@ -10890,7 +10893,7 @@ This could be used to build a version to use as root's shell.
The @samp{minimal-config} option can be used to disable all of
the following options, but it is processed first, so individual
options may be enabled using @samp{enable-@var{feature}}.
options may be enabled using @samp{enable-@var{feature}}.
All of the following options except for
@samp{alt-array-implementation},
@@ -11144,7 +11147,7 @@ Please send all reports concerning this manual to
@appendix Major Differences From The Bourne Shell
Bash implements essentially the same grammar, parameter and
variable expansion, redirection, and quoting as the Bourne Shell.
variable expansion, redirection, and quoting as the Bourne Shell.
Bash uses the @sc{posix} standard as the specification of
how these features are to be implemented and how they should behave.
There are some
@@ -11435,7 +11438,7 @@ The @samp{>|} redirection operator may be used to override @code{noclobber}.
@item
Variable assignments preceding commands affect only that command, even
builtins and functions (@pxref{Environment}).
In @code{sh}, all variable assignments
In @code{sh}, all variable assignments
preceding commands are global unless the command is executed from the
file system.
@@ -11626,7 +11629,7 @@ next child to exit, possibly selecting from a list of supplied jobs,
and the @option{-p} option to store information about a terminated
child process in a shell variable.
@item
@item
The SVR4.2 shell behaves differently when invoked as @code{jsh}
(it turns on job control).
+12 -3
View File
@@ -1291,7 +1291,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
rreeaaddoonnllyy allows the value of a variable to be set at the same time
the readonly attribute is changed by following the variable name
with =_v_a_l_u_e. This sets the value of the variable is to _v_a_l_u_e while
with =_v_a_l_u_e. This sets the value of the variable to _v_a_l_u_e while
modifying the readonly attribute.
The return status is 0 unless an invalid option is encountered, one
@@ -1382,8 +1382,9 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
rate process group. When a background job completes, the
shell prints a line containing its exit status.
--nn Read commands but do not execute them. This may be used to
check a shell script for syntax errors. This is ignored by
interactive shells.
check a shell script for syntax errors. Interactive shells
ignore this option unless it is supplied at invocation along
with the --ii option (see IINNVVOOCCAATTIIOONN in _b_a_s_h(1)).
--oo _o_p_t_i_o_n_-_n_a_m_e
The _o_p_t_i_o_n_-_n_a_m_e can be one of the following:
aalllleexxppoorrtt
@@ -1734,6 +1735,14 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
word and all remaining characters on that line to be ig-
nored, as in a non-interactive shell (see CCOOMMMMEENNTTSS in
_b_a_s_h(1)). This option is enabled by default.
kkvvppaaiirr__sspplliitt
If set, a compound assignment to an associative array per-
forms word expansions, including word splitting, on all
words in the assignment before identifying keys and values.
If it is unset, each word in the compound assignment list is
identified as a key or value before performing the appropri-
ate word expansions, and word splitting is not performed.
This option is enabled by default.
llaassttppiippee
If set, and job control is not active, the shell runs the
last command of a pipeline not executed in the background in
+4 -4
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2026 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Fri Aug 14 15:49:54 EDT 2026
@set LASTCHANGE Thu Aug 20 11:42:13 EDT 2026
@set EDITION 5.3
@set VERSION 5.3
@set EDITION 5.4
@set VERSION 5.4
@set UPDATED 14 August 2026
@set UPDATED 20 August 2026
@set UPDATED-MONTH August 2026
+100 -1
View File
@@ -2850,12 +2850,110 @@ execute_pipeline (COMMAND *command, int asynchronous, int pipe_in, int pipe_out,
return (exec_result);
}
/* This is a placeholder for future work */
#if defined (NON_RECURSIVE_LISTS)
#define COMMAND_LIST(t) \
((t)->type == cm_connection && \
((t)->value.Connection->connector == ';' || (t)->value.Connection->connector == '\n'))
/* This takes advantage of how the parser builds command lists. */
static inline int
count_nodes (COMMAND *command)
{
int n;
COMMAND *t, *prev;
t = command;
n = 0;
/* This needs to be the same test as when the stack gets created in
execute_list() below */
while (t && COMMAND_LIST (t))
{
n++; /* command->second */
t = t->value.Connection->first;
}
n++; /* final terminal node (first command) */
return n;
}
static int
execute_list (COMMAND *command, int asynchronous, int pipe_in, int pipe_out, struct fd_bitmap *fds_to_close)
{
int ignore_return, invert, exec_result, n;
COMMAND *first, *second;
COMMAND **cstack;
size_t csind, cssize;
ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
invert = (command->flags & CMD_INVERT_RETURN) != 0;
interrupt_execution++; retain_fifos++;
QUIT;
n = count_nodes (command);
/*itrace("execute_list: count_nodes returns %d", n);*/
csind = cssize = n + 1;
cstack = (COMMAND **) xreallocarray (NULL, cssize, sizeof (COMMAND *));
/* build the stack from the command list */
first = command;
while (first && COMMAND_LIST (first))
{
if (ignore_return || invert)
{
if (first->value.Connection->first)
first->value.Connection->first->flags |= CMD_IGNORE_RETURN;
if (first->value.Connection->second)
first->value.Connection->second->flags |= CMD_IGNORE_RETURN;
}
cstack[--csind] = first->value.Connection->second;
first = first->value.Connection->first;
}
/* Now we've hit the first command, and it's not a list connector. Execute it. */
exec_result = execute_command (first);
/* Execute all the list commands except the final one */
while (csind < n)
{
first = cstack[csind++];
exec_result = execute_command (first);
#if defined (JOB_CONTROL)
if (job_control && interactive && first->value.Connection->connector == ';')
notify_and_cleanup (-1);
#endif
QUIT;
}
/* Now execute the final one, whose exit status matters. */
second = cstack[csind];
if (second == command->value.Connection->second)
optimize_connection_fork (command);
exec_result = execute_command_internal (second, asynchronous, pipe_in, pipe_out, fds_to_close);
free (cstack);
interrupt_execution--; retain_fifos--;
return exec_result;
}
#else /* !NON_RECURSIVE_LISTS */
/* This is the historical recursive implementation */
static int
execute_list (COMMAND *command, int asynchronous, int pipe_in, int pipe_out, struct fd_bitmap *fds_to_close)
{
int ignore_return, invert, exec_result, n;
COMMAND *first, *second;
#if defined (NON_RECURSIVE_LIST)
COMMAND **cstack;
size_t csind, cssize;
#endif
ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
invert = (command->flags & CMD_INVERT_RETURN) != 0;
@@ -2888,6 +2986,7 @@ execute_list (COMMAND *command, int asynchronous, int pipe_in, int pipe_out, str
interrupt_execution--; retain_fifos--;
return exec_result;
}
#endif /* !NON_RECURSIVE_LISTS */
static int
execute_connection (COMMAND *command, int asynchronous, int pipe_in, int pipe_out, struct fd_bitmap *fds_to_close)
+2 -2
View File
@@ -206,7 +206,7 @@ When a command is described as \fIkilling\fP text, the text
deleted is saved for possible future retrieval
(\fIyanking\fP).
The killed text is saved in a \fIkill ring\fP.
Consecutive kills accumulate the deleted text
Consecutive kills accumulate the deleted text
into one unit, which can be yanked all at once.
Commands which do not kill text separate the chunks of text
on the kill ring.
@@ -775,7 +775,7 @@ names begin with a
.Q .
(hidden files) when performing filename completion.
If set to \fBOff\fP, the user must include the leading
.Q .
.Q .
in the filename to be completed.
.TP
.B menu\-complete\-display\-prefix (Off)
+28 -28
View File
@@ -202,9 +202,9 @@ the installed Readline version.
The value is a hexadecimal
encoding of the major and minor version numbers of the library,
of the form 0x@var{MMmm}. @var{MM} is the two-digit major
version number; @var{mm} is the two-digit minor version number.
version number; @var{mm} is the two-digit minor version number.
For Readline 4.2, for example, the value of
@code{RL_READLINE_VERSION} would be @code{0x0402}.
@code{RL_READLINE_VERSION} would be @code{0x0402}.
@menu
* Readline Typedefs:: C declarations to make code readable.
@@ -353,7 +353,7 @@ to @code{accept-line} and is about to return the line to the caller.
@deftypevar int rl_eof_found
Readline will set this variable when it has read an EOF character
(e.g., the stty @samp{EOF} character) on an empty line
or has encountered a read error or EOF and
or has encountered a read error or EOF and
is about to return a NULL line to the caller.
@end deftypevar
@@ -550,7 +550,7 @@ By default, this is set to @code{rl_deprep_terminal}
(@pxref{Terminal Management}).
@end deftypevar
@deftypevar {void} rl_macro_display_hook
@deftypevar {void} rl_macro_display_hook
If set, this points to a function that @code{rl_macro_dumper} will call to
display a key sequence bound to a macro.
It is called with the key sequence, the "untranslated" macro value (i.e.,
@@ -562,12 +562,12 @@ prefix to display before the key sequence.
@deftypevar {Keymap} rl_executing_keymap
This variable is set to the keymap (@pxref{Keymaps}) in which the
currently executing Readline function was found.
@end deftypevar
@end deftypevar
@deftypevar {Keymap} rl_binding_keymap
This variable is set to the keymap (@pxref{Keymaps}) in which the
last key binding occurred.
@end deftypevar
@end deftypevar
@deftypevar {char *} rl_executing_macro
This variable is set to the text of any currently-executing macro.
@@ -1011,7 +1011,7 @@ Print the names of all bindable Readline functions to @code{rl_outstream}.
@deftypefun {const char **} rl_funmap_names (void)
Return a NULL terminated array of known function names.
The array is sorted.
The array is sorted.
The array itself is allocated, but not the strings inside.
You should free the array, but not the pointers, using @code{free}
or @code{rl_free} when you are done.
@@ -1043,7 +1043,7 @@ This is done with @code{rl_begin_undo_group()} and
The types of events Readline can undo are:
@smallexample
enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @};
enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @};
@end smallexample
Notice that @code{UNDO_DELETE} means to insert some text, and
@@ -1232,7 +1232,7 @@ Replace the contents of @code{rl_line_buffer} with @var{text}.
This preserves the point and mark, if possible.
If @var{clear_undo} is non-zero, this clears the undo list associated
with the current line.
@end deftypefun
@end deftypefun
@deftypefun int rl_push_macro_input (char *macro)
Insert @var{macro} into the line, as if it had been invoked
@@ -1341,7 +1341,7 @@ The bindings are performed in @var{kmap}.
Reset the bindings manipulated by @code{rl_tty_set_default_bindings} so
that the terminal editing characters are bound to @code{rl_insert}.
The bindings are performed in @var{kmap}.
@end deftypefun
@end deftypefun
@deftypefun int rl_tty_set_echoing (int value)
Set Readline's idea of whether or not it is
@@ -1351,7 +1351,7 @@ Readline does not display output to @var{rl_outstream}; any other
value enables output.
The initial value is set when Readline initializes the terminal settings.
This function returns the previous value.
@end deftypefun
@end deftypefun
@deftypefun int rl_reset_terminal (const char *terminal_name)
Reinitialize Readline's idea of the terminal settings using
@@ -1361,31 +1361,31 @@ If @var{terminal_name} is @code{NULL}, Readline uses the value of the
@end deftypefun
@node Utility Functions
@subsection Utility Functions
@subsection Utility Functions
@deftypefun int rl_save_state (struct readline_state *sp)
Save a snapshot of Readline's internal state to @var{sp}.
The contents of the @var{readline_state} structure are
documented in @file{readline.h}.
The caller is responsible for allocating the structure.
@end deftypefun
@end deftypefun
@deftypefun int rl_restore_state (struct readline_state *sp)
Restore Readline's internal state to that stored in @var{sp},
which must have been saved by a call to @code{rl_save_state}.
which must have been saved by a call to @code{rl_save_state}.
The contents of the @var{readline_state} structure are documented in
@file{readline.h}.
The caller is responsible for freeing the structure.
@end deftypefun
The caller is responsible for freeing the structure.
@end deftypefun
@deftypefun void rl_free (void *mem)
Deallocate the memory pointed to by @var{mem}.
@var{mem} must have been allocated by @code{malloc}.
@end deftypefun
@end deftypefun
@deftypefun void rl_extend_line_buffer (int len)
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
characters, reallocating it if necessary.
characters, reallocating it if necessary.
@end deftypefun
@deftypefun int rl_initialize (void)
@@ -1774,7 +1774,7 @@ main (int c, char **v)
sigwinch_received = 0;
@}
if (r < 0)
continue;
continue;
if (FD_ISSET (fileno (rl_instream), &fds))
rl_callback_read_char ();
@@ -1798,11 +1798,11 @@ be sent to the process currently reading input from the keyboard.
Since Readline changes the terminal attributes when it is called, it needs
to perform special processing when such a signal is received in order to
restore the terminal to a sane state, or provide applications using
Readline with functions to do so manually.
Readline with functions to do so manually.
Readline contains an internal signal handler that is installed for a
number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM},
@code{SIGHUP},
@code{SIGHUP},
@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}).
When Readline receives one of these signals, the signal handler
will reset the terminal attributes to those that were in effect before
@@ -1820,7 +1820,7 @@ the kernel sends to a process whenever the terminal's size changes (for
example, if a user resizes an @code{xterm}).
The Readline @code{SIGWINCH} handler updates
Readline's internal screen size information, and then calls any
@code{SIGWINCH} signal handler the calling application has installed.
@code{SIGWINCH} signal handler the calling application has installed.
Readline calls the application's @code{SIGWINCH} signal handler without
resetting the terminal to its original state.
If the application's signal
@@ -1896,7 +1896,7 @@ The default value of @code{rl_change_environment} is 1.
If an application does not wish to have Readline catch any signals, or
to handle signals other than those Readline catches (@code{SIGHUP},
for example),
for example),
Readline provides convenience functions to do the necessary terminal
and internal state cleanup upon receipt of a signal.
@@ -1943,7 +1943,7 @@ to determine whether or not there are any pending signals.
@end deftypefun
If an application does not wish Readline to catch @code{SIGWINCH},
it may call @code{rl_resize_terminal()} or @code{rl_set_screen_size()}
it may call @code{rl_resize_terminal()} or @code{rl_set_screen_size()}
to force Readline to update its idea of the terminal size when it receives
a @code{SIGWINCH}.
@@ -2223,7 +2223,7 @@ characters from a filename before attempting completion,
so those characters do not interfere with matching the text against
names in the filesystem.
It is called with @var{text}, the text of the word
to be dequoted, and @var{quote_char}, which is the quoting character
to be dequoted, and @var{quote_char}, which is the quoting character
that delimits the filename (usually @samp{'} or @samp{"}).
If @var{quote_char} is zero, the filename was not in a quoted string.
@end deftypevar
@@ -2420,7 +2420,7 @@ that possible-completions will display unconditionally.
If there are more possible completions than this,
Readline asks the user for confirmation before displaying them.
The default value is 100.
A negative value
A negative value
indicates that Readline should never ask for confirmation.
@end deftypevar
@@ -2500,7 +2500,7 @@ characters in @code{rl_filename_quote_characters} and
@end deftypevar
@deftypevar int rl_filename_quoting_desired
A non-zero value means that Readline should quote the results of the
A non-zero value means that Readline should quote the results of the
matches using double quotes (or an application-specific quoting mechanism)
if the completed filename contains any characters in
@code{rl_filename_quote_chars}.
@@ -2769,7 +2769,7 @@ stripwhite (char *string)
for (s = string; whitespace (*s); s++)
;
if (*s == 0)
return (s);
+15 -15
View File
@@ -57,7 +57,7 @@ By default, the line editing commands are similar to those of Emacs;
a vi-style line editing interface is also available.
Line editing can be enabled at any time using the @option{-o emacs} or
@option{-o vi} options to the @code{set} builtin command
(@pxref{The Set Builtin}), or disabled using the @option{+o emacs} or
(@pxref{The Set Builtin}), or disabled using the @option{+o emacs} or
@option{+o vi} options to @code{set}.
@end ifset
@@ -637,9 +637,9 @@ When this variable is set to @samp{On}, Readline allows certain commands
to designate the region as @dfn{active}.
When the region is active, Readline highlights the text in the region using
the value of the @code{active-region-start-color}, which defaults to the
string that enables the terminal's standout mode.
string that enables the terminal's standout mode.
The active region shows the text inserted by bracketed-paste and any
matching text found by incremental and non-incremental history searches.
matching text found by incremental and non-incremental history searches.
The default is @samp{On}.
@item enable-bracketed-paste
@@ -650,7 +650,7 @@ of treating each character as if it had been read from the keyboard.
This is called putting the terminal into @dfn{bracketed paste mode};
it prevents Readline from executing any editing commands bound
to key sequences appearing in the pasted text.
The default is @samp{On}.
The default is @samp{On}.
@item enable-keypad
@vindex enable-keypad
@@ -858,7 +858,7 @@ The default value is @samp{off}.
@item show-all-if-ambiguous
@vindex show-all-if-ambiguous
This alters the default behavior of the completion functions.
If set to @samp{on},
If set to @samp{on},
words which have more than one possible completion cause the
matches to be listed immediately instead of ringing the bell.
The default value is @samp{off}.
@@ -867,7 +867,7 @@ The default value is @samp{off}.
@vindex show-all-if-unmodified
This alters the default behavior of the completion functions in
a fashion similar to @var{show-all-if-ambiguous}.
If set to @samp{on},
If set to @samp{on},
words which have more than one possible completion without any
possible partial completion (the possible completions don't share
a common prefix) cause the matches to be listed immediately instead
@@ -1138,7 +1138,7 @@ The @var{application} construct is used to include
application-specific settings.
Each program using the Readline
library sets the @var{application name}, and you can test for
a particular value.
a particular value.
This could be used to bind key sequences to functions useful for
a specific program.
For instance, the following command adds a
@@ -1208,7 +1208,7 @@ $include /etc/Inputrc
#
# Set various bindings for emacs mode.
set editing-mode emacs
set editing-mode emacs
$if mode=emacs
@@ -2186,7 +2186,7 @@ for a command or an argument to a command for which a
completion specification (a @dfn{compspec}) has been defined
using the @code{complete} builtin
(@pxref{Programmable Completion Builtins}),
Readline invokes the programmable completion facilities.
Readline invokes the programmable completion facilities.
First, Bash identifies the command name.
If a compspec has been defined for that command, the
@@ -2231,7 +2231,7 @@ specified by a pathname expansion pattern
supplied as an argument to the
@option{-G} option.
The words generated by the pattern need not match the word being completed.
Bash uses the @env{FIGNORE}
Bash uses the @env{FIGNORE}
variable to filter the matches, but does not use the
@env{GLOBIGNORE} shell variable.
@@ -2275,7 +2275,7 @@ are being completed,
the second argument ($2) is the word being completed,
and the third argument ($3) is the word preceding the word being
completed on the current command line.
There is no filtering of the generated completions against the
There is no filtering of the generated completions against the
word being completed;
the function or command has complete freedom in generating the matches
and they do not need to match a prefix of the word.
@@ -2338,7 +2338,7 @@ to Readline as the list of possible completions.
If the previously-applied actions do not generate any matches, and the
@option{-o dirnames} option was supplied to @code{complete} when the
compspec was defined, Bash attempts directory name completion.
compspec was defined, Bash attempts directory name completion.
If the @option{-o plusdirs} option was supplied to @code{complete} when
the compspec was defined, Bash attempts directory name completion
@@ -2465,7 +2465,7 @@ The @option{-D} option indicates that other supplied options and actions should
apply to the ``default'' command completion; that is, completion attempted
on a command for which no completion has previously been defined.
The @option{-E} option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options and actions should
apply to completion on the initial non-assignment word on the line, or after a
@@ -2490,7 +2490,7 @@ should be quoted to protect them from expansion before the
@item -o @var{comp-option}
The @var{comp-option} controls several aspects of the compspec's behavior
beyond the simple generation of completions.
@var{comp-option} may be one of:
@var{comp-option} may be one of:
@table @code
@@ -2528,7 +2528,7 @@ Tell Readline not to append a space (the default) to words completed at
the end of the line.
@item plusdirs
After generating any matches defined by the compspec,
After generating any matches defined by the compspec,
attempt directory name completion and add any
matches to the results of the other actions.
@end table
+2 -2
View File
@@ -672,10 +672,10 @@ main (int argc, char **argv, char **env)
}
else
{
change_flag ('i', FLAG_ON);
interactive = 1;
if (forced_interactive == 0)
read_but_dont_execute = 0;
change_flag ('i', FLAG_ON);
interactive = 1;
}
#if defined (RESTRICTED_SHELL)
+13 -1
View File
@@ -13236,6 +13236,17 @@ expand_oneword (char *value, int atype)
#if ASSOC_KVPAIR_ASSIGNMENT
kvpair = kvpair_assignment_p (l);
#endif
#if ASSOC_KVPAIR_ASSIGNMENT
/* If we want to split all the words in a kvpair assignment, expand
every word, then single-quote the words in the resulting list, and
return that. */
if (kvpair && split_kvpair_assignments)
{
nl = l ? expand_words_no_vars (l) : l; /* same as arrayfunc.c:assign_assoc_from_kvlist() */
quote_compound_array_list (nl, atype);
return (nl);
}
#endif
/* For associative arrays, with their arbitrary subscripts, we have to
expand and quote in one step so we don't have to search for the
@@ -13244,7 +13255,8 @@ expand_oneword (char *value, int atype)
{
#if ASSOC_KVPAIR_ASSIGNMENT
if (kvpair)
/* keys and values undergo the same set of expansions */
/* keys and values undergo the same set of expansions if we are
not splitting each word in NL. */
t = expand_and_quote_kvpair_word (nl->word->word);
else
#endif
+7 -3
View File
@@ -275,13 +275,13 @@ declare -A a=([")"]="rparen" ["\""]="dquote" ["]"]="rbracket" ["\\"]="bs" )
declare -Arx foo=([two]="2" [three]="3" [one]="1" )
./assoc11.sub: line 90: foo: readonly variable
assoc12.sub
declare -A v1=(["1 2"]="3" )
declare -A v1=([3]="" [1]="2" )
declare -A v2=(["1 2"]="3" )
declare -A v3=([3]="" [1]="2" )
declare -A v1=(["1 2"]="3 4 5" )
declare -A v1=([5]="" [3]="4" [1]="2" )
declare -A v2=(["1 2"]="3 4 5" )
declare -A v3=([5]="" [3]="4" [1]="2" )
declare -A v1=(["1 2"]="3 4 5" )
declare -A v1=([4]="5" ["1 2"]="3" )
declare -A v2=(["1 2"]="3 4 5" )
declare -A v3=([4]="5" ["1 2"]="3" )
declare -A v1=(["1 2"]="3 4 5" )
@@ -293,6 +293,10 @@ declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="xtra" )
declare -A v1=([80]="xtra" ["20 40 80"]="new xtra" ["1 2"]="3 4 5" [20]="40" )
declare -A v2=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="new xtra" )
declare -A assoc=([four]="4" [two]="2" [three]="3" [one]="1" [zero]="0" )
declare -A assoc=([four]="4" [two]="2" [three]="3" [one]="1" [zero]="0" )
declare -A copy=([four]="4" [two]="2" [three]="3" [one]="1" [zero]="0" )
declare -A copy=([four]="4" [two]="2" [three]="3" [one]="1" [zero]="0" )
assoc13.sub
declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" )
at
+36 -8
View File
@@ -15,25 +15,25 @@ foo='1 2'
bar='3 4 5'
xtra='20 40 80'
declare -A v1=( $foo 3 )
declare -A v1=( $foo 3 ) # unquoted expansions are now split
declare -p v1
declare -A v2=( [$foo]=3 )
declare -A v2=( [$foo]=3 ) # but subscripts are not
declare -p v2
declare -A v3
v3=( $foo 3 )
declare -A v3
v3=( $foo 3 ) # declaration commands and assignments are identical
declare -p v3
unset v1 v2 v3
declare -A v1=( $foo $bar )
declare -A v1=( $foo $bar ) # unquoted expansions are split
declare -p v1
declare -A v2=( [$foo]=$bar )
declare -p v2
declare -A v3
declare -A v3
v3=( $foo $bar )
declare -p v3
@@ -45,7 +45,7 @@ declare -p v1
declare -A v2=( ["$foo"]=$bar )
declare -p v2
declare -A v3
declare -A v3
v3=( "$foo" $bar )
declare -p v3
@@ -57,7 +57,7 @@ declare -p v1
declare -A v2=( ["$foo"]="$bar" )
declare -p v2
declare -A v3
declare -A v3
v3=( "$foo" "$bar" )
declare -p v3
@@ -72,3 +72,31 @@ v2+=( ["$xtra"]='new xtra' )
v3+=( ['$xtra']='new xtra' )
declare -p v1 v2 v3
unset v1 v2 v3
# we can now copy arrays from an array of key-value pairs or by generating
# a list of key-value pairs
declare -a kv=(zero 0 one 1 two 2 three 3 four 4)
# assign associative array from an array of key-value pairs
declare -A assoc
assoc=( "${kv[@]}" )
declare -p assoc
unset assoc
# do the same thing using a declaration command
declare -A assoc=( "${kv[@]}" )
declare -p assoc
# copy an associative array using key-value pairs
declare -A copy
copy=( "${assoc[@]@k}" )
declare -p copy
unset copy
# do the same thing using a declaration command
declare -A copy=( "${assoc[@]@k}" )
declare -p copy
+1 -1
View File
@@ -447,7 +447,7 @@ SEE ALSO
bash(1)
IMPLEMENTATION
Copyright (C) 2025 Free Software Foundation, Inc.
Copyright (C) 2026 Free Software Foundation, Inc.
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
+2 -2
View File
@@ -144,9 +144,9 @@ three
(exit 42)
42
history2.sub
5.3
5.4
echo ${BASH_VERSION%\.*}
5.3
5.4
echo ${BASH_VERSION%\.*}
history3.sub
a
+13 -13
View File
@@ -670,7 +670,7 @@ A
declare -A foo
LOWER
Lower
argv[1] = <host(2)[5.3]$ >
argv[1] = <host(2)[5.4]$ >
argv[1] = <~$ >
argv[1] = <^A[0]~$ >
argv[1] = <^A^G^B[0:1]~\$ >
@@ -826,26 +826,26 @@ otwone
new-exp17.sub
unquoted word expansion with quoted pattern and replacement
4.2: 4.2, a &lt; b
5.3: 4.2, a &lt; b
5.3: 5.2, a &lt; b
5.4: 4.2, a &lt; b
5.4: 5.2, a &lt; b
double-quoted word expansion with quoted pattern and replacement
4.2: 4.2, a '&lt;' b
5.3: 4.2, a '&lt;' b
5.3: 5.2, a &lt; b
5.4: 4.2, a '&lt;' b
5.4: 5.2, a &lt; b
unquoted word expansion with unquoted pattern and replacement
4.2: 4.2, a &lt; b
5.3: 4.2, a <lt; b
5.3: 5.2, a <lt; b
5.4: 4.2, a <lt; b
5.4: 5.2, a <lt; b
double-quoted word expansion with unquoted pattern and replacement
4.2: 4.2, a &lt; b
5.3: 4.2, a &lt; b
5.3: 5.2, a <lt; b
5.4: 4.2, a &lt; b
5.4: 5.2, a <lt; b
unquoted word expansion with backslash-quoted &
4.2: 4.2, a &lt; b
5.3: 4.2, a &lt; b
5.3: 5.2, a &lt; b
5.4: 4.2, a &lt; b
5.4: 5.2, a &lt; b
double-quoted word expansion with backslash-quoted &
4.2: 4.2, a \&lt; b
5.3: 4.2, a \&lt; b
5.3: 5.2, a &lt; b
5.4: 4.2, a \&lt; b
5.4: 5.2, a &lt; b
./new-exp.tests: line 1: ABXD: parameter unset
+2 -2
View File
@@ -1,6 +1,6 @@
/* version.c -- distribution and version numbers. */
/* Copyright (C) 1989-2025 Free Software Foundation, Inc.
/* Copyright (C) 1989-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -47,7 +47,7 @@ const char * const release_status = (char *)0;
#endif
const char * const sccs_version = SCCSVERSION;
const char * const bash_copyright = N_("Copyright (C) 2025 Free Software Foundation, Inc.");
const char * const bash_copyright = N_("Copyright (C) 2026 Free Software Foundation, Inc.");
const char * const bash_license = N_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
/* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */