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 c...@case.edu http://tiswww.cwru.edu/~chet/