mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-09 13:10:50 +02:00
change to behavior of '&' in pattern substitution replacement string; fix for blank lines in multiline commands saved in command history
This commit is contained in:
+30
-20
@@ -9,7 +9,7 @@ SSYYNNOOPPSSIISS
|
||||
bbaasshh [options] [command_string | file]
|
||||
|
||||
CCOOPPYYRRIIGGHHTT
|
||||
Bash is Copyright (C) 1989-2021 by the Free Software Foundation, Inc.
|
||||
Bash is Copyright (C) 1989-2022 by the Free Software Foundation, Inc.
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
BBaasshh is an sshh-compatible command language interpreter that executes
|
||||
@@ -1849,24 +1849,34 @@ EEXXPPAANNSSIIOONN
|
||||
end of the expanded value of _p_a_r_a_m_e_t_e_r. If the expansion of
|
||||
_s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted. If _s_t_r_i_n_g is
|
||||
null, matches of _p_a_t_t_e_r_n are deleted and the // following _p_a_t_t_e_r_n
|
||||
may be omitted. If the ppaattssuubb__rreeppllaacceemmeenntt shell option is en-
|
||||
abled using sshhoopptt, any unquoted instances of && in _s_t_r_i_n_g are re-
|
||||
placed with the matching portion of _p_a_t_t_e_r_n. Backslash is used
|
||||
to quote && in _s_t_r_i_n_g; the backslash is removed in order to per-
|
||||
mit a literal && in the replacement string. Users should take
|
||||
care if _s_t_r_i_n_g is double-quoted to avoid unwanted interactions
|
||||
between the backslash and double-quoting. Pattern substitution
|
||||
performs the check for && after expanding _s_t_r_i_n_g; shell program-
|
||||
mers should quote backslashes intended to escape the && and in-
|
||||
hibit replacement so they survive any quote removal performed by
|
||||
the expansion of _s_t_r_i_n_g. If the nnooccaasseemmaattcchh shell option is en-
|
||||
abled, the match is performed without regard to the case of al-
|
||||
phabetic characters. If _p_a_r_a_m_e_t_e_r is @@ or **, the substitution
|
||||
operation is applied to each positional parameter in turn, and
|
||||
the expansion is the resultant list. If _p_a_r_a_m_e_t_e_r is an array
|
||||
variable subscripted with @@ or **, the substitution operation is
|
||||
applied to each member of the array in turn, and the expansion
|
||||
is the resultant list.
|
||||
may be omitted.
|
||||
|
||||
If the ppaattssuubb__rreeppllaacceemmeenntt shell option is enabled using sshhoopptt,
|
||||
any unquoted instances of && in _s_t_r_i_n_g are replaced with the
|
||||
matching portion of _p_a_t_t_e_r_n.
|
||||
|
||||
Quoting any part of _s_t_r_i_n_g inhibits replacement in the expansion
|
||||
of the quoted portion, including replacement strings stored in
|
||||
shell variables. Backslash will escape && in _s_t_r_i_n_g; the back-
|
||||
slash is removed in order to permit a literal && in the replace-
|
||||
ment string. Backslash can also be used to escape a backslash;
|
||||
\\\\ results in a literal backslash in the replacement. Users
|
||||
should take care if _s_t_r_i_n_g is double-quoted to avoid unwanted
|
||||
interactions between the backslash and double-quoting, since
|
||||
backslash has special meaning within double quotes. Pattern
|
||||
substitution performs the check for unquoted && after expanding
|
||||
_s_t_r_i_n_g; shell programmers should quote any occurrences of && they
|
||||
want to be taken literally in the replacement and ensure any in-
|
||||
stances of && they want to be replaced are unquoted.
|
||||
|
||||
If the nnooccaasseemmaattcchh shell option is enabled, the match is per-
|
||||
formed without regard to the case of alphabetic characters. If
|
||||
_p_a_r_a_m_e_t_e_r is @@ or **, the substitution operation is applied to
|
||||
each positional parameter in turn, and the expansion is the re-
|
||||
sultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted
|
||||
with @@ or **, the substitution operation is applied to each mem-
|
||||
ber of the array in turn, and the expansion is the resultant
|
||||
list.
|
||||
|
||||
${_p_a_r_a_m_e_t_e_r^^_p_a_t_t_e_r_n}
|
||||
${_p_a_r_a_m_e_t_e_r^^^^_p_a_t_t_e_r_n}
|
||||
@@ -6597,4 +6607,4 @@ BBUUGGSS
|
||||
|
||||
|
||||
|
||||
GNU Bash 5.2 2021 December 26 BASH(1)
|
||||
GNU Bash 5.2 2022 January 17 BASH(1)
|
||||
|
||||
Reference in New Issue
Block a user