Comment 2 for bug 105634

Revision history for this message
Paul Smith (psmith-gnu) wrote :

FYI, some relevant details from POSIX:

Section 2.3, Token Recognition:

5. If the current character is an unquoted '$' or '`', the shell shall identify the start of any candidates for parameter expansion ( Parameter Expansion), command substitution ( Command Substitution), or arithmetic expansion ( Arithmetic Expansion) from their introductory unquoted character sequences: '$' or "${", "$(" or '`', and "$((", respectively. The shell shall read sufficient input to determine the end of the unit to be expanded (as explained in the cited sections).

Section 2.6.2, Parameter Expansion:

The format for parameter expansion is as follows:

    ${expression}

where expression consists of all characters until the matching '}'. Any '}' escaped by a backslash or within a quoted string, and characters in embedded arithmetic expansions, command substitutions, and variable expansions, shall not be examined in determining the matching '}'.

[...]

The parameter name or symbol can be enclosed in braces, which are optional except for positional parameters with more than one digit or when parameter is followed by a character that could be interpreted as part of the name. The matching closing brace shall be determined by counting brace levels, skipping over enclosed quoted strings, and command substitutions.

---

In addition to bash I've checked Solaris /bin/sh and ksh and they don't report an error.