On 7/18/22 2:11 AM, Koichi Murase wrote:
Here is another patch that was pending.

Bash Version: 5.2
Commit 87a6e89edc7cb1af057e2c15666df189595d305b (the current devel)

Description:

   When `shopt -s patsub_replacement' is turned on and the pattern
   string `pat' of ${var/$pat/"&"} is just an anchoring character `#'
   or `%', the internal escape of `&' (i.e., `\&') remains in the
   result of the parameter expansion.  Also, with the same condition,
   the unquoted & in ${var/$pat/&} remains a literal & where we expect
   it to be expanded to an empty string.

Thanks for the patch. I think this is reasonable; it duplicates what `sed'
does when presented with a BRE like '^' or '$', or when it gets a null
input line. I'll put this in for 5.2-rc2.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to