fix history expansion to not perform quick substitution on a new line that's part of a quoted string; save the value of $_ around prompt string decoding

This commit is contained in:
Chet Ramey
2023-12-19 09:56:34 -05:00
parent 9d51df7546
commit aa2d23cfac
24 changed files with 1973 additions and 1779 deletions
+173 -163
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.3, 6 November 2023).
Bash shell (version 5.3, 14 December 2023).
This is Edition 5.3, last updated 6 November 2023, of 'The GNU Bash
This is Edition 5.3, last updated 14 December 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
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.3, 6 November 2023). The Bash home page is
Bash shell (version 5.3, 14 December 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 6 November 2023, of 'The GNU Bash
This is Edition 5.3, last updated 14 December 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -3806,24 +3806,25 @@ standard.
'-p'
Display Readline function names and bindings in such a way
that they can be used as input or in a Readline initialization
file.
that they can be used as an argument to a subsequent 'bind'
command or in a Readline initialization file.
'-P'
List current Readline function names and bindings.
'-v'
Display Readline variable names and values in such a way that
they can be used as input or in a Readline initialization
file.
they can be used as an argument to a subsequent 'bind' command
or in a Readline initialization file.
'-V'
List current Readline variable names and values.
'-s'
Display Readline key sequences bound to macros and the strings
they output in such a way that they can be used as input or in
a Readline initialization file.
they output in such a way that they can be used as an argument
to a subsequent 'bind' command or in a Readline initialization
file.
'-S'
Display Readline key sequences bound to macros and the strings
@@ -3866,7 +3867,8 @@ standard.
'-X'
List all key sequences bound to shell commands and the
associated commands in a format that can be reused as input.
associated commands in a format that can be reused as an
argument to a subsequent 'bind' command.
The return status is zero unless an invalid option is supplied or
an error occurs.
@@ -5736,7 +5738,7 @@ Variables::).
first character is the "history expansion" character, that is, the
character which signifies the start of a history expansion,
normally '!'. The second character is the character which
signifies 'quick substitution' when seen as the first character on
signifies "quick substitution" when seen as the first character on
a line, normally '^'. The optional third character is the
character which indicates that the remainder of the line is a
comment when found as the first character of a word, usually '#'.
@@ -10480,6 +10482,14 @@ history expansion character, but the history expansion character is also
treated as quoted if it immediately precedes the closing double quote in
a double-quoted string.
There is a special abbreviation for substitution, active when the
QUICK SUBSTITUTION character (default '^') is the first character on the
line. It selects the previous history list entry, using an event
designator equivalent to '!!', and substitutes one string for another in
that line. It is described below (*note Event Designators::). This is
the only history expansion that does not begin with the history
expansion character.
Several shell options settable with the 'shopt' builtin (*note The
Shopt Builtin::) may be used to tailor the behavior of history
expansion. If the 'histverify' shell option is enabled, and Readline is
@@ -12139,11 +12149,11 @@ D.1 Index of Shell Builtin Commands
* bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins.
(line 37)
* builtin: Bash Builtins. (line 117)
* caller: Bash Builtins. (line 126)
* builtin: Bash Builtins. (line 119)
* caller: Bash Builtins. (line 128)
* cd: Bourne Shell Builtins.
(line 45)
* command: Bash Builtins. (line 143)
* command: Bash Builtins. (line 145)
* compgen: Programmable Completion Builtins.
(line 12)
* complete: Programmable Completion Builtins.
@@ -12152,13 +12162,13 @@ D.1 Index of Shell Builtin Commands
(line 248)
* continue: Bourne Shell Builtins.
(line 90)
* declare: Bash Builtins. (line 163)
* declare: Bash Builtins. (line 165)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 104)
* echo: Bash Builtins. (line 266)
* enable: Bash Builtins. (line 315)
* echo: Bash Builtins. (line 268)
* enable: Bash Builtins. (line 317)
* eval: Bourne Shell Builtins.
(line 99)
* exec: Bourne Shell Builtins.
@@ -12177,26 +12187,26 @@ D.1 Index of Shell Builtin Commands
(line 153)
* hash: Bourne Shell Builtins.
(line 197)
* help: Bash Builtins. (line 353)
* help: Bash Builtins. (line 355)
* history: Bash History Builtins.
(line 46)
* jobs: Job Control Builtins.
(line 27)
* kill: Job Control Builtins.
(line 58)
* let: Bash Builtins. (line 372)
* local: Bash Builtins. (line 380)
* logout: Bash Builtins. (line 397)
* mapfile: Bash Builtins. (line 402)
* let: Bash Builtins. (line 374)
* local: Bash Builtins. (line 382)
* logout: Bash Builtins. (line 399)
* mapfile: Bash Builtins. (line 404)
* popd: Directory Stack Builtins.
(line 35)
* printf: Bash Builtins. (line 448)
* printf: Bash Builtins. (line 450)
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 222)
* read: Bash Builtins. (line 516)
* readarray: Bash Builtins. (line 619)
* read: Bash Builtins. (line 518)
* readarray: Bash Builtins. (line 621)
* readonly: Bourne Shell Builtins.
(line 232)
* return: Bourne Shell Builtins.
@@ -12205,7 +12215,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 272)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 628)
* source: Bash Builtins. (line 630)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
@@ -12216,12 +12226,12 @@ D.1 Index of Shell Builtin Commands
(line 393)
* true: Bourne Shell Builtins.
(line 455)
* type: Bash Builtins. (line 633)
* typeset: Bash Builtins. (line 671)
* ulimit: Bash Builtins. (line 677)
* type: Bash Builtins. (line 635)
* typeset: Bash Builtins. (line 673)
* ulimit: Bash Builtins. (line 679)
* umask: Bourne Shell Builtins.
(line 460)
* unalias: Bash Builtins. (line 783)
* unalias: Bash Builtins. (line 785)
* unset: Bourne Shell Builtins.
(line 478)
* wait: Job Control Builtins.
@@ -12899,138 +12909,138 @@ D.5 Concept Index

Tag Table:
Node: Top895
Node: Introduction2813
Node: What is Bash?3029
Node: What is a shell?4143
Node: Definitions6681
Node: Basic Shell Features9632
Node: Shell Syntax10851
Node: Shell Operation11877
Node: Quoting13170
Node: Escape Character14474
Node: Single Quotes14959
Node: Double Quotes15307
Node: ANSI-C Quoting16585
Node: Locale Translation17897
Node: Creating Internationalized Scripts19208
Node: Comments23325
Node: Shell Commands23943
Node: Reserved Words24881
Node: Simple Commands25637
Node: Pipelines26291
Node: Lists29277
Node: Compound Commands31072
Node: Looping Constructs32084
Node: Conditional Constructs34579
Node: Command Grouping49067
Node: Coprocesses50545
Node: GNU Parallel53208
Node: Shell Functions54125
Node: Shell Parameters62010
Node: Positional Parameters66398
Node: Special Parameters67300
Node: Shell Expansions70514
Node: Brace Expansion72602
Node: Tilde Expansion75336
Node: Shell Parameter Expansion77957
Node: Command Substitution96550
Node: Arithmetic Expansion100014
Node: Process Substitution100982
Node: Word Splitting102102
Node: Filename Expansion104150
Node: Pattern Matching107083
Node: Quote Removal112085
Node: Redirections112380
Node: Executing Commands122074
Node: Simple Command Expansion122744
Node: Command Search and Execution124854
Node: Command Execution Environment127241
Node: Environment130276
Node: Exit Status131939
Node: Signals133723
Node: Shell Scripts137172
Node: Shell Builtin Commands140199
Node: Bourne Shell Builtins142237
Node: Bash Builtins165629
Node: Modifying Shell Behavior198681
Node: The Set Builtin199026
Node: The Shopt Builtin210000
Node: Special Builtins226195
Node: Shell Variables227187
Node: Bourne Shell Variables227624
Node: Bash Variables229728
Node: Bash Features264797
Node: Invoking Bash265810
Node: Bash Startup Files271944
Node: Interactive Shells277075
Node: What is an Interactive Shell?277486
Node: Is this Shell Interactive?278135
Node: Interactive Shell Behavior278950
Node: Bash Conditional Expressions282579
Node: Shell Arithmetic287492
Node: Aliases290453
Node: Arrays293347
Node: The Directory Stack299981
Node: Directory Stack Builtins300765
Node: Controlling the Prompt305025
Node: The Restricted Shell307990
Node: Bash POSIX Mode310600
Node: Shell Compatibility Mode327245
Node: Job Control335493
Node: Job Control Basics335953
Node: Job Control Builtins340955
Node: Job Control Variables346750
Node: Command Line Editing347906
Node: Introduction and Notation349577
Node: Readline Interaction351200
Node: Readline Bare Essentials352391
Node: Readline Movement Commands354180
Node: Readline Killing Commands355140
Node: Readline Arguments357061
Node: Searching358105
Node: Readline Init File360291
Node: Readline Init File Syntax361552
Node: Conditional Init Constructs385577
Node: Sample Init File389773
Node: Bindable Readline Commands392897
Node: Commands For Moving394101
Node: Commands For History396152
Node: Commands For Text401146
Node: Commands For Killing405124
Node: Numeric Arguments407828
Node: Commands For Completion408967
Node: Keyboard Macros413158
Node: Miscellaneous Commands413846
Node: Readline vi Mode420215
Node: Programmable Completion421122
Node: Programmable Completion Builtins428902
Node: A Programmable Completion Example440022
Node: Using History Interactively445270
Node: Bash History Facilities445954
Node: Bash History Builtins448965
Node: History Interaction454056
Node: Event Designators457869
Node: Word Designators459407
Node: Modifiers461272
Node: Installing Bash463080
Node: Basic Installation464217
Node: Compilers and Options467939
Node: Compiling For Multiple Architectures468680
Node: Installation Names470372
Node: Specifying the System Type472481
Node: Sharing Defaults473198
Node: Operation Controls473871
Node: Optional Features474829
Node: Reporting Bugs486049
Node: Major Differences From The Bourne Shell487383
Node: GNU Free Documentation License504241
Node: Indexes529418
Node: Builtin Index529872
Node: Reserved Word Index536973
Node: Variable Index539421
Node: Function Index556555
Node: Concept Index570414
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 Translation17901
Node: Creating Internationalized Scripts19212
Node: Comments23329
Node: Shell Commands23947
Node: Reserved Words24885
Node: Simple Commands25641
Node: Pipelines26295
Node: Lists29281
Node: Compound Commands31076
Node: Looping Constructs32088
Node: Conditional Constructs34583
Node: Command Grouping49071
Node: Coprocesses50549
Node: GNU Parallel53212
Node: Shell Functions54129
Node: Shell Parameters62014
Node: Positional Parameters66402
Node: Special Parameters67304
Node: Shell Expansions70518
Node: Brace Expansion72606
Node: Tilde Expansion75340
Node: Shell Parameter Expansion77961
Node: Command Substitution96554
Node: Arithmetic Expansion100018
Node: Process Substitution100986
Node: Word Splitting102106
Node: Filename Expansion104154
Node: Pattern Matching107087
Node: Quote Removal112089
Node: Redirections112384
Node: Executing Commands122078
Node: Simple Command Expansion122748
Node: Command Search and Execution124858
Node: Command Execution Environment127245
Node: Environment130280
Node: Exit Status131943
Node: Signals133727
Node: Shell Scripts137176
Node: Shell Builtin Commands140203
Node: Bourne Shell Builtins142241
Node: Bash Builtins165633
Node: Modifying Shell Behavior198853
Node: The Set Builtin199198
Node: The Shopt Builtin210172
Node: Special Builtins226367
Node: Shell Variables227359
Node: Bourne Shell Variables227796
Node: Bash Variables229900
Node: Bash Features264969
Node: Invoking Bash265982
Node: Bash Startup Files272116
Node: Interactive Shells277247
Node: What is an Interactive Shell?277658
Node: Is this Shell Interactive?278307
Node: Interactive Shell Behavior279122
Node: Bash Conditional Expressions282751
Node: Shell Arithmetic287664
Node: Aliases290625
Node: Arrays293519
Node: The Directory Stack300153
Node: Directory Stack Builtins300937
Node: Controlling the Prompt305197
Node: The Restricted Shell308162
Node: Bash POSIX Mode310772
Node: Shell Compatibility Mode327417
Node: Job Control335665
Node: Job Control Basics336125
Node: Job Control Builtins341127
Node: Job Control Variables346922
Node: Command Line Editing348078
Node: Introduction and Notation349749
Node: Readline Interaction351372
Node: Readline Bare Essentials352563
Node: Readline Movement Commands354352
Node: Readline Killing Commands355312
Node: Readline Arguments357233
Node: Searching358277
Node: Readline Init File360463
Node: Readline Init File Syntax361724
Node: Conditional Init Constructs385749
Node: Sample Init File389945
Node: Bindable Readline Commands393069
Node: Commands For Moving394273
Node: Commands For History396324
Node: Commands For Text401318
Node: Commands For Killing405296
Node: Numeric Arguments408000
Node: Commands For Completion409139
Node: Keyboard Macros413330
Node: Miscellaneous Commands414018
Node: Readline vi Mode420387
Node: Programmable Completion421294
Node: Programmable Completion Builtins429074
Node: A Programmable Completion Example440194
Node: Using History Interactively445442
Node: Bash History Facilities446126
Node: Bash History Builtins449137
Node: History Interaction454228
Node: Event Designators458480
Node: Word Designators460018
Node: Modifiers461883
Node: Installing Bash463691
Node: Basic Installation464828
Node: Compilers and Options468550
Node: Compiling For Multiple Architectures469291
Node: Installation Names470983
Node: Specifying the System Type473092
Node: Sharing Defaults473809
Node: Operation Controls474482
Node: Optional Features475440
Node: Reporting Bugs486660
Node: Major Differences From The Bourne Shell487994
Node: GNU Free Documentation License504852
Node: Indexes530029
Node: Builtin Index530483
Node: Reserved Word Index537584
Node: Variable Index540032
Node: Function Index557166
Node: Concept Index571025

End Tag Table