bug-bash
[Top][All Lists]
Advanced

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

Re: Bash-5.1-beta available


From: Chet Ramey
Subject: Re: Bash-5.1-beta available
Date: Sun, 13 Sep 2020 14:29:15 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 9/13/20 8:21 AM, Andreas Schwab wrote:
> On Sep 10 2020, Chet Ramey wrote:
> 
>> qqq. Fixed a bug that could cause backslashes quoting double quotes in here
>>      document bodies to not be removed when expanding the body.
> 
> Are you sure about this?  My reading of POSIX says that a backslash
> before a double quote should not be removed, as double quotes are not
> special in here docs.

The specific construct is

P=A
cat <<EOF
${P+\"$P\"}
EOF

from https://lists.gnu.org/archive/html/bug-bash/2019-01/msg00193.html .

In this case, the usual proscription on double quotes in here-documents
does not apply, since the double quote appears within ${}.

This change makes the above and

echo "${P+\"$P\"}"

echo the same thing.

The bash-5.1 behavior is consistent with what other shells claiming POSIX
conformance, except the BSD ash-based shells, produce. There's pretty wide
variance in behavior between shells with all of the variants of putting a
double quote inside a parameter expansion inside a here-document, and
POSIX has basically thrown its hands in the air in disgust.

-- 
``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]