.
Last update: 1997-05-20
9945-2-102
_____________________________________________________________________________
Topic: shell "here-documents"
Relevant Sections: 3.7.4
Defect Report:
-----------------------
Date: Thu, 23 Mar 1995 15:09:54 -0800
From: Fred Zlotnick <fred@mindcraft.com>
I would like to request an official, binding interpretation from
WG15 concerning the following point in ISO/IEC 9945-2:1993 (POSIX.2).
In the description of shell "here-documents" in POSIX.2 subclause 3.7.4,
the standard states in part:
If no characters in word [the here-document delimiter] are
quoted, all lines of the here-document shall be expanded for
parameter expansion, command substitution and arithmetic
expansion. In this case, the backslash in the input will
behave as the backslash inside double-quotes (see 3.2.3).
However, the double-quote character (") will not be treated
specially within a here-document, except when the double-quote
appears within $( ), ` ` or ${ }.
The reference to section 3.2.3 refers (I believe) to the following text:
The backslash shall retain its special meaning as an escape
character (see 3.2.1) only when followed by one of the characters
$ ` " \ <newline>
If the here-document delimiter has not been quoted then does section 3.7.4
modify section 3.2.1 such that backslash is NOT an escape character when
followed by the double-quote character? That is, does the "However" clause
mean that '\"' should not be replaced with '"'? For example, consider the
here-document:
cat << EOF
x\"y\"z
EOF
The output of this here-document may be either
x"y"z
or
x\"y\"z
depending on how one reads the specification. Thank you for your attention
to this matter.
Interpretation response
------------------------
The standard is unclear on this issue, and no conformance distinction can
be made between alternative implementations based on this. This is being
referred to the sponsor.
Rationale:
None
Forwarded to Interpretations group: Mar 28 1995
Proposed resolution circulated: May 16th
Comments due: June 15th
Finalised: June 16th 1995