Interpretations

Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretation for IEEE Std 1003.2™-1992 IEEE Standard for Information Technology--Portable Operating System Interfaces (POSIX®)--Part 2: Shell and Utilities

Copyright © 1996 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #102
Topic:
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
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 for Interpretation
None.