mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-05 03:10:50 +02:00
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:
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Thu Jan 19 17:20:59 EST 2023
|
||||
.\" Last Change: Thu Dec 14 15:42:44 EST 2023
|
||||
.\"
|
||||
.TH HISTORY 3 "2023 January 19" "GNU History 8.2"
|
||||
.TH HISTORY 3 "2023 December 14" "GNU History 8.3"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -74,10 +74,21 @@ does when reading input,
|
||||
so that several words that would otherwise be separated
|
||||
are considered one word when surrounded by quotes (see the
|
||||
description of \fBhistory_tokenize()\fP below).
|
||||
.PP
|
||||
History expansions are introduced by the appearance of the
|
||||
history expansion character, which is \^\fB!\fP\^ by default.
|
||||
Only backslash (\^\fB\e\fP\^) and single quotes can quote
|
||||
the history expansion character.
|
||||
.PP
|
||||
There is a special abbreviation for substitution, active when the
|
||||
\fIquick substitution\fP character (default \fB\(ha\fP)
|
||||
is the first character on the line.
|
||||
It selects the previous history list entry, using an event designator
|
||||
equivalent to \fB!!\fP,
|
||||
and substitutes one string for another in that line.
|
||||
It is described below under \fBEvent Designators\fP.
|
||||
This is the only history expansion that does not begin with the history
|
||||
expansion character.
|
||||
.SS Event Designators
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
|
||||
@@ -316,6 +316,16 @@ also treated as quoted if it immediately precedes the closing double quote
|
||||
in a double-quoted string.
|
||||
@end ifset
|
||||
|
||||
There is a special abbreviation for substitution, active when the
|
||||
@var{quick substitution} character (default @samp{^})
|
||||
is the first character on the line.
|
||||
It selects the previous history list entry, using an event designator
|
||||
equivalent to @code{!!},
|
||||
and substitutes one string for another in that line.
|
||||
It is described below (@pxref{Event Designators}).
|
||||
This is the only history expansion that does not begin with the history
|
||||
expansion character.
|
||||
|
||||
@ifset BashFeatures
|
||||
Several shell options settable with the @code{shopt}
|
||||
builtin (@pxref{The Shopt Builtin}) may be used to tailor
|
||||
|
||||
@@ -5,7 +5,7 @@ Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@set EDITION 8.3
|
||||
@set VERSION 8.3
|
||||
|
||||
@set UPDATED 3 November 2023
|
||||
@set UPDATED-MONTH November 2023
|
||||
@set UPDATED 14 December 2023
|
||||
@set UPDATED-MONTH December 2023
|
||||
|
||||
@set LASTCHANGE Fri Nov 3 12:04:26 EDT 2023
|
||||
@set LASTCHANGE Thu Dec 14 15:45:46 EST 2023
|
||||
|
||||
@@ -950,7 +950,7 @@ history_expand (const char *hstring, char **output)
|
||||
/* The quick substitution character is a history expansion all right. That
|
||||
is to say, "^this^that^" is equivalent to "!!:s^this^that^", and in fact,
|
||||
that is the substitution that we do. */
|
||||
if (hstring[0] == history_subst_char)
|
||||
if ((history_quoting_state != '\'' || history_quotes_inhibit_expansion == 0) && hstring[0] == history_subst_char)
|
||||
{
|
||||
string = (char *)xmalloc (l + 5);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user