





Interpretation Request #102
shell "here-documents" Relevant Clauses: 3.7.4

I would like to request an official, binding interpretation from the IEEE concerning the following point in IEEE Std 1003.2-1992 (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 subclause 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 subclause 3.7.4 modify subclause 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.

Interpretation Response #102

Rationale for Interpretation