bash asan fixes; minor documentation updates

This commit is contained in:
Chet Ramey
2023-03-15 14:59:24 -04:00
parent 01084938a1
commit 437b73931c
11 changed files with 2620 additions and 2551 deletions
+29
View File
@@ -5632,3 +5632,32 @@ lib/readline/vi_mode.c
This prevents referencing vimvcxt after freeing it in the case that
these functions call each other recursively (e.g., y1y1, c1d1, etc.).
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
3/14
----
bashhist.c
- bash_add_history: make sure curlen is large enough before checking
curlen - 1 and curlen - 2, otherwise you can get buffer underflow.
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
bashline.c
- bash_spell_correct_shellword: don't bother trying to correct empty
words. Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
lib/sh/shquote.c
- sh_mkdoublequoted: make sure to allocate enough memory for the
pathological case: where every character in the string needs to be
backslash-escaped because it's special within double quotes.
Fixes asan bug reported by Grisha Levit <grishalevit@gmail.com>
doc/{bash.1,bashref.texi}
- here documents: make sure the summary specifies the here-document is
terminated by `delimiter'; specify what the delimiter is if the word
is not quoted. Prompted by a help-bash post from
goncholden <goncholden@protonmail.com>
3/15
----
doc/bash.1,lib/readline/doc/rluser.texi
- shell-expand-line: enumerate the specific expansions performed.
From a request by Alex Bochannek <alex@bochannek.com>
+2 -2
View File
@@ -896,7 +896,7 @@ bash_add_history (char *line)
curlen = strlen (current->line);
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\\' &&
current->line[curlen - 2] != '\\')
(curlen < 2 || current->line[curlen - 2] != '\\'))
{
current->line[curlen - 1] = '\0';
curlen--;
@@ -907,7 +907,7 @@ bash_add_history (char *line)
entry ends with a newline, and we're going to add a semicolon,
don't. In some cases, it results in a syntax error (e.g., before
a close brace), and it should not be needed. */
if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\n' && *chars_to_add == ';')
if (dstack.delimiter_depth == 0 && curlen > 0 && current->line[curlen - 1] == '\n' && *chars_to_add == ';')
chars_to_add++;
new_line = (char *)xmalloc (1
+2
View File
@@ -1344,6 +1344,8 @@ bash_spell_correct_shellword (int count, int key)
break;
text = rl_copy_text (wbeg, wend);
if (text == 0 || *text == 0)
break;
newdir = dirspell (text);
if (newdir)
+2203 -2192
View File
File diff suppressed because it is too large Load Diff
+14 -9
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Mon Feb 20 09:59:47 EST 2023
.\" Last Change: Tue Mar 14 16:19:06 EDT 2023
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2023 February 20" "GNU Bash 5.2"
.TH BASH 1 "2023 March 14" "GNU Bash 5.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -4255,9 +4255,8 @@ This is semantically equivalent to
This type of redirection instructs the shell to read input from the
current source until a line containing only
.I delimiter
(with no trailing blanks)
is seen. All of
the lines read up to that point are then used as the standard
(with no trailing blanks) is seen.
All of the lines read up to that point are then used as the standard
input (or file descriptor \fIn\fP if \fIn\fP is specified) for a command.
.PP
The format of here-documents is:
@@ -4273,6 +4272,7 @@ The format of here-documents is:
No parameter and variable expansion, command substitution,
arithmetic expansion, or pathname expansion is performed on
.IR word .
.PP
If any part of
.I word
is quoted, the
@@ -4280,7 +4280,9 @@ is quoted, the
is the result of quote removal on
.IR word ,
and the lines in the here-document are not expanded.
If \fIword\fP is unquoted,
If \fIword\fP is unquoted, the
.I delimiter
is \fIword\fP itself,
all lines of the here-document are subjected to
parameter expansion, command substitution, and arithmetic expansion,
the character sequence
@@ -6627,9 +6629,12 @@ The history expansion facilities are used to extract the last word,
as if the "!$" history expansion had been specified.
.TP
.B shell\-expand\-line (M\-C\-e)
Expand the line as the shell does. This
performs alias and history expansion as well as all of the shell
word expansions. See
Expand the line by performing shell word expansions.
This performs alias and history expansion,
\fB$\fP\(aq\fIstring\fP\(aq and \fB$\fP\(dq\fIstring\fP\(dq quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
word splitting, and quote removal.
See
.SM
.B HISTORY EXPANSION
below for a description of history expansion.
+177 -168
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 20 February 2023).
Bash shell (version 5.2, 14 March 2023).
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 20 February 2023). The Bash home page is
Bash shell (version 5.2, 14 March 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -2326,19 +2326,23 @@ quotes for word splitting.
The shell treats each character of '$IFS' as a delimiter, and splits
the results of the other expansions into words using these characters as
field terminators. If 'IFS' is unset, or its value is exactly
'<space><tab><newline>', the default, then sequences of ' <space>',
'<tab>', and '<newline>' at the beginning and end of the results of the
previous expansions are ignored, and any sequence of 'IFS' characters
not at the beginning or end serves to delimit words. If 'IFS' has a
value other than the default, then sequences of the whitespace
characters 'space', 'tab', and 'newline' are ignored at the beginning
and end of the word, as long as the whitespace character is in the value
of 'IFS' (an 'IFS' whitespace character). Any character in 'IFS' that
is not 'IFS' whitespace, along with any adjacent 'IFS' whitespace
characters, delimits a field. A sequence of 'IFS' whitespace characters
is also treated as a delimiter. If the value of 'IFS' is null, no word
splitting occurs.
field terminators.
If 'IFS' is unset, or its value is exactly '<space><tab><newline>',
the default, then sequences of 'space', 'tab', and 'newline' at the
beginning and end of the results of the previous expansions are ignored,
and any sequence of 'IFS' characters not at the beginning or end serves
to delimit words. If 'IFS' has a value other than the default, then
sequences of the whitespace characters 'space', 'tab', and 'newline' are
ignored at the beginning and end of the word, as long as the whitespace
character is in the value of 'IFS' (an 'IFS' whitespace character). Any
character in 'IFS' that is not 'IFS' whitespace, along with any adjacent
'IFS' whitespace characters, delimits a field. A sequence of 'IFS'
whitespace characters is also treated as a delimiter.
If the value of 'IFS' is null, no word splitting occurs. If 'IFS' is
unset, word splitting behaves as if it contained the default value
'<space><tab><newline>'.
Explicit null arguments ('""' or '''') are retained and passed to
commands as empty strings. Unquoted implicit null arguments, resulting
@@ -2678,7 +2682,7 @@ This is semantically equivalent to
--------------------
This type of redirection instructs the shell to read input from the
current source until a line containing only WORD (with no trailing
current source until a line containing only DELIMITER (with no trailing
blanks) is seen. All of the lines read up to that point are then used
as the standard input (or file descriptor N if N is specified) for a
command.
@@ -2689,13 +2693,15 @@ command.
DELIMITER
No parameter and variable expansion, command substitution, arithmetic
expansion, or filename expansion is performed on WORD. If any part of
WORD is quoted, the DELIMITER is the result of quote removal on WORD,
and the lines in the here-document are not expanded. If WORD is
unquoted, all lines of the here-document are subjected to parameter
expansion, command substitution, and arithmetic expansion, the character
sequence '\newline' is ignored, and '\' must be used to quote the
characters '\', '$', and '`'.
expansion, or filename expansion is performed on WORD.
If any part of WORD is quoted, the DELIMITER is the result of quote
removal on WORD, and the lines in the here-document are not expanded.
If WORD is unquoted, DELIMITER is WORD itself, all lines of the
here-document are subjected to parameter expansion, command
substitution, and arithmetic expansion, the character sequence
'\newline' is ignored, and '\' must be used to quote the characters '\',
'$', and '`'.
If the redirection operator is '<<-', then all leading tab characters
are stripped from input lines and the line containing DELIMITER. This
@@ -6702,8 +6708,10 @@ indexed arrays, if the optional subscript is supplied, that index is
assigned to; otherwise the index of the element assigned is the last
index assigned to by the statement plus one. Indexing starts at zero.
Each VALUE in the list undergoes all the shell expansions described
above (*note Shell Expansions::).
Each VALUE in the list undergoes the shell expansions described above
(*note Shell Expansions::), but VALUEs that are valid variable
assignments including the brackets and subscript do not undergo brace
expansion and word splitting, as with individual variable assignments.
When assigning to an associative array, the words in a compound
assignment may be either assignment statements, for which the subscript
@@ -9411,9 +9419,10 @@ File: bash.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bin
Display version information about the current instance of Bash.
'shell-expand-line (M-C-e)'
Expand the line as the shell does. This performs alias and history
expansion as well as all of the shell word expansions (*note Shell
Expansions::).
Expand the line by performing shell word expansions. This performs
alias and history expansion, $'STRING' and $"STRING" quoting, tilde
expansion, parameter and variable expansion, arithmetic expansion,
word splitting, and quote removal.
'history-expand-line (M-^)'
Perform history expansion on the current line.
@@ -12240,7 +12249,7 @@ D.4 Function Index
* accept-line (Newline or Return): Commands For History.
(line 6)
* alias-expand-line (): Miscellaneous Commands.
(line 131)
(line 132)
* backward-char (C-b): Commands For Moving. (line 15)
* backward-delete-char (Rubout): Commands For Text. (line 17)
* backward-kill-line (C-x Rubout): Commands For Killing.
@@ -12302,7 +12311,7 @@ D.4 Function Index
* dynamic-complete-history (M-<TAB>): Commands For Completion.
(line 90)
* edit-and-execute-command (C-x C-e): Miscellaneous Commands.
(line 140)
(line 141)
* end-kbd-macro (C-x )): Keyboard Macros. (line 9)
* end-of-file (usually C-d): Commands For Text. (line 6)
* end-of-history (M->): Commands For History.
@@ -12324,9 +12333,9 @@ D.4 Function Index
* glob-list-expansions (C-x g): Miscellaneous Commands.
(line 110)
* history-and-alias-expand-line (): Miscellaneous Commands.
(line 134)
(line 135)
* history-expand-line (M-^): Miscellaneous Commands.
(line 124)
(line 125)
* history-search-backward (): Commands For History.
(line 57)
* history-search-forward (): Commands For History.
@@ -12340,7 +12349,7 @@ D.4 Function Index
* insert-completions (M-*): Commands For Completion.
(line 22)
* insert-last-argument (M-. or M-_): Miscellaneous Commands.
(line 137)
(line 138)
* kill-line (C-k): Commands For Killing.
(line 6)
* kill-region (): Commands For Killing.
@@ -12350,7 +12359,7 @@ D.4 Function Index
* kill-word (M-d): Commands For Killing.
(line 23)
* magic-space (): Miscellaneous Commands.
(line 127)
(line 128)
* menu-complete (): Commands For Completion.
(line 26)
* menu-complete-backward (): Commands For Completion.
@@ -12603,138 +12612,138 @@ D.5 Concept Index

Tag Table:
Node: Top894
Node: Introduction2811
Node: What is Bash?3024
Node: What is a shell?4135
Node: Definitions6670
Node: Basic Shell Features9618
Node: Shell Syntax10834
Node: Shell Operation11857
Node: Quoting13147
Node: Escape Character14448
Node: Single Quotes14930
Node: Double Quotes15275
Node: ANSI-C Quoting16550
Node: Locale Translation17857
Node: Creating Internationalized Scripts19165
Node: Comments23279
Node: Shell Commands23894
Node: Reserved Words24829
Node: Simple Commands25582
Node: Pipelines26233
Node: Lists29229
Node: Compound Commands31021
Node: Looping Constructs32030
Node: Conditional Constructs34522
Node: Command Grouping49007
Node: Coprocesses50482
Node: GNU Parallel53142
Node: Shell Functions54056
Node: Shell Parameters61938
Node: Positional Parameters66323
Node: Special Parameters67222
Node: Shell Expansions70433
Node: Brace Expansion72557
Node: Tilde Expansion75288
Node: Shell Parameter Expansion77906
Node: Command Substitution96305
Node: Arithmetic Expansion97657
Node: Process Substitution98622
Node: Word Splitting99739
Node: Filename Expansion101680
Node: Pattern Matching104426
Node: Quote Removal109425
Node: Redirections109717
Node: Executing Commands119374
Node: Simple Command Expansion120041
Node: Command Search and Execution122148
Node: Command Execution Environment124532
Node: Environment127564
Node: Exit Status129224
Node: Signals131005
Node: Shell Scripts134451
Node: Shell Builtin Commands137475
Node: Bourne Shell Builtins139510
Node: Bash Builtins161705
Node: Modifying Shell Behavior193701
Node: The Set Builtin194043
Node: The Shopt Builtin204638
Node: Special Builtins220547
Node: Shell Variables221523
Node: Bourne Shell Variables221957
Node: Bash Variables224058
Node: Bash Features256870
Node: Invoking Bash257880
Node: Bash Startup Files263890
Node: Interactive Shells269018
Node: What is an Interactive Shell?269426
Node: Is this Shell Interactive?270072
Node: Interactive Shell Behavior270884
Node: Bash Conditional Expressions274510
Node: Shell Arithmetic279149
Node: Aliases282090
Node: Arrays284981
Node: The Directory Stack291369
Node: Directory Stack Builtins292150
Node: Controlling the Prompt296407
Node: The Restricted Shell299369
Node: Bash POSIX Mode301976
Node: Shell Compatibility Mode314839
Node: Job Control323403
Node: Job Control Basics323860
Node: Job Control Builtins328859
Node: Job Control Variables334651
Node: Command Line Editing335804
Node: Introduction and Notation337472
Node: Readline Interaction339092
Node: Readline Bare Essentials340280
Node: Readline Movement Commands342066
Node: Readline Killing Commands343023
Node: Readline Arguments344941
Node: Searching345982
Node: Readline Init File348165
Node: Readline Init File Syntax349423
Node: Conditional Init Constructs373211
Node: Sample Init File377404
Node: Bindable Readline Commands380525
Node: Commands For Moving381726
Node: Commands For History383774
Node: Commands For Text388765
Node: Commands For Killing392411
Node: Numeric Arguments395441
Node: Commands For Completion396577
Node: Keyboard Macros400765
Node: Miscellaneous Commands401450
Node: Readline vi Mode407392
Node: Programmable Completion408296
Node: Programmable Completion Builtins416073
Node: A Programmable Completion Example426822
Node: Using History Interactively432067
Node: Bash History Facilities432748
Node: Bash History Builtins435750
Node: History Interaction440771
Node: Event Designators444388
Node: Word Designators445739
Node: Modifiers447496
Node: Installing Bash449301
Node: Basic Installation450435
Node: Compilers and Options454154
Node: Compiling For Multiple Architectures454892
Node: Installation Names456581
Node: Specifying the System Type458687
Node: Sharing Defaults459401
Node: Operation Controls460071
Node: Optional Features461026
Node: Reporting Bugs472242
Node: Major Differences From The Bourne Shell473583
Node: GNU Free Documentation License490429
Node: Indexes515603
Node: Builtin Index516054
Node: Reserved Word Index522878
Node: Variable Index525323
Node: Function Index542235
Node: Concept Index556016
Node: Top888
Node: Introduction2799
Node: What is Bash?3012
Node: What is a shell?4123
Node: Definitions6658
Node: Basic Shell Features9606
Node: Shell Syntax10822
Node: Shell Operation11845
Node: Quoting13135
Node: Escape Character14436
Node: Single Quotes14918
Node: Double Quotes15263
Node: ANSI-C Quoting16538
Node: Locale Translation17845
Node: Creating Internationalized Scripts19153
Node: Comments23267
Node: Shell Commands23882
Node: Reserved Words24817
Node: Simple Commands25570
Node: Pipelines26221
Node: Lists29217
Node: Compound Commands31009
Node: Looping Constructs32018
Node: Conditional Constructs34510
Node: Command Grouping48995
Node: Coprocesses50470
Node: GNU Parallel53130
Node: Shell Functions54044
Node: Shell Parameters61926
Node: Positional Parameters66311
Node: Special Parameters67210
Node: Shell Expansions70421
Node: Brace Expansion72545
Node: Tilde Expansion75276
Node: Shell Parameter Expansion77894
Node: Command Substitution96293
Node: Arithmetic Expansion97645
Node: Process Substitution98610
Node: Word Splitting99727
Node: Filename Expansion101772
Node: Pattern Matching104518
Node: Quote Removal109517
Node: Redirections109809
Node: Executing Commands119499
Node: Simple Command Expansion120166
Node: Command Search and Execution122273
Node: Command Execution Environment124657
Node: Environment127689
Node: Exit Status129349
Node: Signals131130
Node: Shell Scripts134576
Node: Shell Builtin Commands137600
Node: Bourne Shell Builtins139635
Node: Bash Builtins161830
Node: Modifying Shell Behavior193826
Node: The Set Builtin194168
Node: The Shopt Builtin204763
Node: Special Builtins220672
Node: Shell Variables221648
Node: Bourne Shell Variables222082
Node: Bash Variables224183
Node: Bash Features256995
Node: Invoking Bash258005
Node: Bash Startup Files264015
Node: Interactive Shells269143
Node: What is an Interactive Shell?269551
Node: Is this Shell Interactive?270197
Node: Interactive Shell Behavior271009
Node: Bash Conditional Expressions274635
Node: Shell Arithmetic279274
Node: Aliases282215
Node: Arrays285106
Node: The Directory Stack291666
Node: Directory Stack Builtins292447
Node: Controlling the Prompt296704
Node: The Restricted Shell299666
Node: Bash POSIX Mode302273
Node: Shell Compatibility Mode315136
Node: Job Control323700
Node: Job Control Basics324157
Node: Job Control Builtins329156
Node: Job Control Variables334948
Node: Command Line Editing336101
Node: Introduction and Notation337769
Node: Readline Interaction339389
Node: Readline Bare Essentials340577
Node: Readline Movement Commands342363
Node: Readline Killing Commands343320
Node: Readline Arguments345238
Node: Searching346279
Node: Readline Init File348462
Node: Readline Init File Syntax349720
Node: Conditional Init Constructs373508
Node: Sample Init File377701
Node: Bindable Readline Commands380822
Node: Commands For Moving382023
Node: Commands For History384071
Node: Commands For Text389062
Node: Commands For Killing392708
Node: Numeric Arguments395738
Node: Commands For Completion396874
Node: Keyboard Macros401062
Node: Miscellaneous Commands401747
Node: Readline vi Mode407782
Node: Programmable Completion408686
Node: Programmable Completion Builtins416463
Node: A Programmable Completion Example427212
Node: Using History Interactively432457
Node: Bash History Facilities433138
Node: Bash History Builtins436140
Node: History Interaction441161
Node: Event Designators444778
Node: Word Designators446129
Node: Modifiers447886
Node: Installing Bash449691
Node: Basic Installation450825
Node: Compilers and Options454544
Node: Compiling For Multiple Architectures455282
Node: Installation Names456971
Node: Specifying the System Type459077
Node: Sharing Defaults459791
Node: Operation Controls460461
Node: Optional Features461416
Node: Reporting Bugs472632
Node: Major Differences From The Bourne Shell473973
Node: GNU Free Documentation License490819
Node: Indexes515993
Node: Builtin Index516444
Node: Reserved Word Index523268
Node: Variable Index525713
Node: Function Index542625
Node: Concept Index556406

End Tag Table
+177 -168
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 20 February 2023).
Bash shell (version 5.2, 14 March 2023).
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 20 February 2023). The Bash home page is
Bash shell (version 5.2, 14 March 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 14 March 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -2327,19 +2327,23 @@ quotes for word splitting.
The shell treats each character of '$IFS' as a delimiter, and splits
the results of the other expansions into words using these characters as
field terminators. If 'IFS' is unset, or its value is exactly
'<space><tab><newline>', the default, then sequences of ' <space>',
'<tab>', and '<newline>' at the beginning and end of the results of the
previous expansions are ignored, and any sequence of 'IFS' characters
not at the beginning or end serves to delimit words. If 'IFS' has a
value other than the default, then sequences of the whitespace
characters 'space', 'tab', and 'newline' are ignored at the beginning
and end of the word, as long as the whitespace character is in the value
of 'IFS' (an 'IFS' whitespace character). Any character in 'IFS' that
is not 'IFS' whitespace, along with any adjacent 'IFS' whitespace
characters, delimits a field. A sequence of 'IFS' whitespace characters
is also treated as a delimiter. If the value of 'IFS' is null, no word
splitting occurs.
field terminators.
If 'IFS' is unset, or its value is exactly '<space><tab><newline>',
the default, then sequences of 'space', 'tab', and 'newline' at the
beginning and end of the results of the previous expansions are ignored,
and any sequence of 'IFS' characters not at the beginning or end serves
to delimit words. If 'IFS' has a value other than the default, then
sequences of the whitespace characters 'space', 'tab', and 'newline' are
ignored at the beginning and end of the word, as long as the whitespace
character is in the value of 'IFS' (an 'IFS' whitespace character). Any
character in 'IFS' that is not 'IFS' whitespace, along with any adjacent
'IFS' whitespace characters, delimits a field. A sequence of 'IFS'
whitespace characters is also treated as a delimiter.
If the value of 'IFS' is null, no word splitting occurs. If 'IFS' is
unset, word splitting behaves as if it contained the default value
'<space><tab><newline>'.
Explicit null arguments ('""' or '''') are retained and passed to
commands as empty strings. Unquoted implicit null arguments, resulting
@@ -2679,7 +2683,7 @@ This is semantically equivalent to
--------------------
This type of redirection instructs the shell to read input from the
current source until a line containing only WORD (with no trailing
current source until a line containing only DELIMITER (with no trailing
blanks) is seen. All of the lines read up to that point are then used
as the standard input (or file descriptor N if N is specified) for a
command.
@@ -2690,13 +2694,15 @@ command.
DELIMITER
No parameter and variable expansion, command substitution, arithmetic
expansion, or filename expansion is performed on WORD. If any part of
WORD is quoted, the DELIMITER is the result of quote removal on WORD,
and the lines in the here-document are not expanded. If WORD is
unquoted, all lines of the here-document are subjected to parameter
expansion, command substitution, and arithmetic expansion, the character
sequence '\newline' is ignored, and '\' must be used to quote the
characters '\', '$', and '`'.
expansion, or filename expansion is performed on WORD.
If any part of WORD is quoted, the DELIMITER is the result of quote
removal on WORD, and the lines in the here-document are not expanded.
If WORD is unquoted, DELIMITER is WORD itself, all lines of the
here-document are subjected to parameter expansion, command
substitution, and arithmetic expansion, the character sequence
'\newline' is ignored, and '\' must be used to quote the characters '\',
'$', and '`'.
If the redirection operator is '<<-', then all leading tab characters
are stripped from input lines and the line containing DELIMITER. This
@@ -6703,8 +6709,10 @@ indexed arrays, if the optional subscript is supplied, that index is
assigned to; otherwise the index of the element assigned is the last
index assigned to by the statement plus one. Indexing starts at zero.
Each VALUE in the list undergoes all the shell expansions described
above (*note Shell Expansions::).
Each VALUE in the list undergoes the shell expansions described above
(*note Shell Expansions::), but VALUEs that are valid variable
assignments including the brackets and subscript do not undergo brace
expansion and word splitting, as with individual variable assignments.
When assigning to an associative array, the words in a compound
assignment may be either assignment statements, for which the subscript
@@ -9412,9 +9420,10 @@ File: bashref.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up:
Display version information about the current instance of Bash.
'shell-expand-line (M-C-e)'
Expand the line as the shell does. This performs alias and history
expansion as well as all of the shell word expansions (*note Shell
Expansions::).
Expand the line by performing shell word expansions. This performs
alias and history expansion, $'STRING' and $"STRING" quoting, tilde
expansion, parameter and variable expansion, arithmetic expansion,
word splitting, and quote removal.
'history-expand-line (M-^)'
Perform history expansion on the current line.
@@ -12241,7 +12250,7 @@ D.4 Function Index
* accept-line (Newline or Return): Commands For History.
(line 6)
* alias-expand-line (): Miscellaneous Commands.
(line 131)
(line 132)
* backward-char (C-b): Commands For Moving. (line 15)
* backward-delete-char (Rubout): Commands For Text. (line 17)
* backward-kill-line (C-x Rubout): Commands For Killing.
@@ -12303,7 +12312,7 @@ D.4 Function Index
* dynamic-complete-history (M-<TAB>): Commands For Completion.
(line 90)
* edit-and-execute-command (C-x C-e): Miscellaneous Commands.
(line 140)
(line 141)
* end-kbd-macro (C-x )): Keyboard Macros. (line 9)
* end-of-file (usually C-d): Commands For Text. (line 6)
* end-of-history (M->): Commands For History.
@@ -12325,9 +12334,9 @@ D.4 Function Index
* glob-list-expansions (C-x g): Miscellaneous Commands.
(line 110)
* history-and-alias-expand-line (): Miscellaneous Commands.
(line 134)
(line 135)
* history-expand-line (M-^): Miscellaneous Commands.
(line 124)
(line 125)
* history-search-backward (): Commands For History.
(line 57)
* history-search-forward (): Commands For History.
@@ -12341,7 +12350,7 @@ D.4 Function Index
* insert-completions (M-*): Commands For Completion.
(line 22)
* insert-last-argument (M-. or M-_): Miscellaneous Commands.
(line 137)
(line 138)
* kill-line (C-k): Commands For Killing.
(line 6)
* kill-region (): Commands For Killing.
@@ -12351,7 +12360,7 @@ D.4 Function Index
* kill-word (M-d): Commands For Killing.
(line 23)
* magic-space (): Miscellaneous Commands.
(line 127)
(line 128)
* menu-complete (): Commands For Completion.
(line 26)
* menu-complete-backward (): Commands For Completion.
@@ -12604,138 +12613,138 @@ D.5 Concept Index

Tag Table:
Node: Top897
Node: Introduction2817
Node: What is Bash?3033
Node: What is a shell?4147
Node: Definitions6685
Node: Basic Shell Features9636
Node: Shell Syntax10855
Node: Shell Operation11881
Node: Quoting13174
Node: Escape Character14478
Node: Single Quotes14963
Node: Double Quotes15311
Node: ANSI-C Quoting16589
Node: Locale Translation17899
Node: Creating Internationalized Scripts19210
Node: Comments23327
Node: Shell Commands23945
Node: Reserved Words24883
Node: Simple Commands25639
Node: Pipelines26293
Node: Lists29292
Node: Compound Commands31087
Node: Looping Constructs32099
Node: Conditional Constructs34594
Node: Command Grouping49082
Node: Coprocesses50560
Node: GNU Parallel53223
Node: Shell Functions54140
Node: Shell Parameters62025
Node: Positional Parameters66413
Node: Special Parameters67315
Node: Shell Expansions70529
Node: Brace Expansion72656
Node: Tilde Expansion75390
Node: Shell Parameter Expansion78011
Node: Command Substitution96413
Node: Arithmetic Expansion97768
Node: Process Substitution98736
Node: Word Splitting99856
Node: Filename Expansion101800
Node: Pattern Matching104549
Node: Quote Removal109551
Node: Redirections109846
Node: Executing Commands119506
Node: Simple Command Expansion120176
Node: Command Search and Execution122286
Node: Command Execution Environment124673
Node: Environment127708
Node: Exit Status129371
Node: Signals131155
Node: Shell Scripts134604
Node: Shell Builtin Commands137631
Node: Bourne Shell Builtins139669
Node: Bash Builtins161867
Node: Modifying Shell Behavior193866
Node: The Set Builtin194211
Node: The Shopt Builtin204809
Node: Special Builtins220721
Node: Shell Variables221700
Node: Bourne Shell Variables222137
Node: Bash Variables224241
Node: Bash Features257056
Node: Invoking Bash258069
Node: Bash Startup Files264082
Node: Interactive Shells269213
Node: What is an Interactive Shell?269624
Node: Is this Shell Interactive?270273
Node: Interactive Shell Behavior271088
Node: Bash Conditional Expressions274717
Node: Shell Arithmetic279359
Node: Aliases282303
Node: Arrays285197
Node: The Directory Stack291588
Node: Directory Stack Builtins292372
Node: Controlling the Prompt296632
Node: The Restricted Shell299597
Node: Bash POSIX Mode302207
Node: Shell Compatibility Mode315073
Node: Job Control323640
Node: Job Control Basics324100
Node: Job Control Builtins329102
Node: Job Control Variables334897
Node: Command Line Editing336053
Node: Introduction and Notation337724
Node: Readline Interaction339347
Node: Readline Bare Essentials340538
Node: Readline Movement Commands342327
Node: Readline Killing Commands343287
Node: Readline Arguments345208
Node: Searching346252
Node: Readline Init File348438
Node: Readline Init File Syntax349699
Node: Conditional Init Constructs373490
Node: Sample Init File377686
Node: Bindable Readline Commands380810
Node: Commands For Moving382014
Node: Commands For History384065
Node: Commands For Text389059
Node: Commands For Killing392708
Node: Numeric Arguments395741
Node: Commands For Completion396880
Node: Keyboard Macros401071
Node: Miscellaneous Commands401759
Node: Readline vi Mode407704
Node: Programmable Completion408611
Node: Programmable Completion Builtins416391
Node: A Programmable Completion Example427143
Node: Using History Interactively432391
Node: Bash History Facilities433075
Node: Bash History Builtins436080
Node: History Interaction441104
Node: Event Designators444724
Node: Word Designators446078
Node: Modifiers447838
Node: Installing Bash449646
Node: Basic Installation450783
Node: Compilers and Options454505
Node: Compiling For Multiple Architectures455246
Node: Installation Names456938
Node: Specifying the System Type459047
Node: Sharing Defaults459764
Node: Operation Controls460437
Node: Optional Features461395
Node: Reporting Bugs472614
Node: Major Differences From The Bourne Shell473958
Node: GNU Free Documentation License490807
Node: Indexes515984
Node: Builtin Index516438
Node: Reserved Word Index523265
Node: Variable Index525713
Node: Function Index542628
Node: Concept Index556412
Node: Top891
Node: Introduction2805
Node: What is Bash?3021
Node: What is a shell?4135
Node: Definitions6673
Node: Basic Shell Features9624
Node: Shell Syntax10843
Node: Shell Operation11869
Node: Quoting13162
Node: Escape Character14466
Node: Single Quotes14951
Node: Double Quotes15299
Node: ANSI-C Quoting16577
Node: Locale Translation17887
Node: Creating Internationalized Scripts19198
Node: Comments23315
Node: Shell Commands23933
Node: Reserved Words24871
Node: Simple Commands25627
Node: Pipelines26281
Node: Lists29280
Node: Compound Commands31075
Node: Looping Constructs32087
Node: Conditional Constructs34582
Node: Command Grouping49070
Node: Coprocesses50548
Node: GNU Parallel53211
Node: Shell Functions54128
Node: Shell Parameters62013
Node: Positional Parameters66401
Node: Special Parameters67303
Node: Shell Expansions70517
Node: Brace Expansion72644
Node: Tilde Expansion75378
Node: Shell Parameter Expansion77999
Node: Command Substitution96401
Node: Arithmetic Expansion97756
Node: Process Substitution98724
Node: Word Splitting99844
Node: Filename Expansion101892
Node: Pattern Matching104641
Node: Quote Removal109643
Node: Redirections109938
Node: Executing Commands119631
Node: Simple Command Expansion120301
Node: Command Search and Execution122411
Node: Command Execution Environment124798
Node: Environment127833
Node: Exit Status129496
Node: Signals131280
Node: Shell Scripts134729
Node: Shell Builtin Commands137756
Node: Bourne Shell Builtins139794
Node: Bash Builtins161992
Node: Modifying Shell Behavior193991
Node: The Set Builtin194336
Node: The Shopt Builtin204934
Node: Special Builtins220846
Node: Shell Variables221825
Node: Bourne Shell Variables222262
Node: Bash Variables224366
Node: Bash Features257181
Node: Invoking Bash258194
Node: Bash Startup Files264207
Node: Interactive Shells269338
Node: What is an Interactive Shell?269749
Node: Is this Shell Interactive?270398
Node: Interactive Shell Behavior271213
Node: Bash Conditional Expressions274842
Node: Shell Arithmetic279484
Node: Aliases282428
Node: Arrays285322
Node: The Directory Stack291885
Node: Directory Stack Builtins292669
Node: Controlling the Prompt296929
Node: The Restricted Shell299894
Node: Bash POSIX Mode302504
Node: Shell Compatibility Mode315370
Node: Job Control323937
Node: Job Control Basics324397
Node: Job Control Builtins329399
Node: Job Control Variables335194
Node: Command Line Editing336350
Node: Introduction and Notation338021
Node: Readline Interaction339644
Node: Readline Bare Essentials340835
Node: Readline Movement Commands342624
Node: Readline Killing Commands343584
Node: Readline Arguments345505
Node: Searching346549
Node: Readline Init File348735
Node: Readline Init File Syntax349996
Node: Conditional Init Constructs373787
Node: Sample Init File377983
Node: Bindable Readline Commands381107
Node: Commands For Moving382311
Node: Commands For History384362
Node: Commands For Text389356
Node: Commands For Killing393005
Node: Numeric Arguments396038
Node: Commands For Completion397177
Node: Keyboard Macros401368
Node: Miscellaneous Commands402056
Node: Readline vi Mode408094
Node: Programmable Completion409001
Node: Programmable Completion Builtins416781
Node: A Programmable Completion Example427533
Node: Using History Interactively432781
Node: Bash History Facilities433465
Node: Bash History Builtins436470
Node: History Interaction441494
Node: Event Designators445114
Node: Word Designators446468
Node: Modifiers448228
Node: Installing Bash450036
Node: Basic Installation451173
Node: Compilers and Options454895
Node: Compiling For Multiple Architectures455636
Node: Installation Names457328
Node: Specifying the System Type459437
Node: Sharing Defaults460154
Node: Operation Controls460827
Node: Optional Features461785
Node: Reporting Bugs473004
Node: Major Differences From The Bourne Shell474348
Node: GNU Free Documentation License491197
Node: Indexes516374
Node: Builtin Index516828
Node: Reserved Word Index523655
Node: Variable Index526103
Node: Function Index543018
Node: Concept Index556802

End Tag Table
+7 -4
View File
@@ -3156,9 +3156,9 @@ This is semantically equivalent to
@subsection Here Documents
This type of redirection instructs the shell to read input from the
current source until a line containing only @var{word}
(with no trailing blanks) is seen. All of
the lines read up to that point are then used as the standard
current source until a line containing only @var{delimiter}
(with no trailing blanks) is seen.
All of the lines read up to that point are then used as the standard
input (or file descriptor @var{n} if @var{n} is specified) for a command.
The format of here-documents is:
@@ -3170,10 +3170,13 @@ The format of here-documents is:
No parameter and variable expansion, command substitution,
arithmetic expansion, or filename expansion is performed on
@var{word}. If any part of @var{word} is quoted, the
@var{word}.
If any part of @var{word} is quoted, the
@var{delimiter} is the result of quote removal on @var{word},
and the lines in the here-document are not expanded.
If @var{word} is unquoted,
@var{delimiter} is @var{word} itself,
all lines of the here-document are subjected to
parameter expansion, command substitution, and arithmetic expansion,
the character sequence @code{\newline} is ignored, and @samp{\}
+3 -4
View File
@@ -2,11 +2,10 @@
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Mon Feb 20 09:59:31 EST 2023
@set LASTCHANGE Tue Mar 14 16:18:40 EDT 2023
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 20 February 2023
@set UPDATED-MONTH February 2023
@set UPDATED 14 March 2023
@set UPDATED-MONTH March 2023
+5 -3
View File
@@ -1864,9 +1864,11 @@ pathname expansion.
Display version information about the current instance of Bash.
@item shell-expand-line (M-C-e)
Expand the line as the shell does.
This performs alias and history expansion as well as all of the shell
word expansions (@pxref{Shell Expansions}).
Expand the line by performing shell word expansions.
This performs alias and history expansion,
$'@var{string}' and $"@var{string}" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
word splitting, and quote removal.
@item history-expand-line (M-^)
Perform history expansion on the current line.
+1 -1
View File
@@ -188,7 +188,7 @@ sh_mkdoublequoted (const char *s, size_t slen, int flags)
send = s + slen;
mb_cur_max = flags ? MB_CUR_MAX : 1;
rlen = (flags == 0) ? slen + 3 : (2 * slen) + 1;
rlen = (flags == 0) ? slen + 3 : (2 * slen) + 3;
ret = r = (char *)xmalloc (rlen);
*r++ = '"';