bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: devel: Questions about quoting in the new replacement ${var/pat/&}


From: Chet Ramey
Subject: Re: devel: Questions about quoting in the new replacement ${var/pat/&}
Date: Wed, 19 Jan 2022 19:39:00 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1

On 1/18/22 8:50 PM, Koichi Murase wrote:
Thank you for your consideration and for implementing it.  I have
tried the latest devel branch and played with it.  I now really like
its behavior.  Thank you very much for taking it into consideration.

It's this kind of back and forth I find valuable.

It probably won't be in bash-5.2-alpha, since I already froze and tested
that, but the behavior will be different in the next devel branch push
after that.

Does that mean it will be in bash-5.2-beta or in bash-5.3?  I am
interested in what would be the behavior of the release version of
bash-5.2, which would affect how I will modify my script.

It will be in bash-5.2-beta.


I still like the simpler explanation: if bash-5.1 expanded `string' to
something that contained an unescaped `&', replace it. If it expanded to
something that contained a literal '\&' you'll get a `&'. Backslash-escaped
backslashes produce a single literal backslash. But allowing double quotes
to inhibit the replacement is probably better for backwards compatibility,
even with patsub_replacement off by default.

Is this an explanation that will be put in ChangeLog or in Bash
Reference Manual?

No, because that explanation does not match the current behavior. It
matched the original behavior.

There is fairly extensive documentation in the current version of the
texinfo manual. Take a look; tell me what you think.

Chet

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]