On 11/19/10 1:20 PM, Matt Zyzik wrote: > bug-bash, > > I am noticing a behavior that appears to be a bug. Additionally, what I > am expecting to happen is the actual behavior in both Zsh and Ksh. > > This is the command (ignore leading whitespace): > echo "${fpbnoinervzkjeh:-'good morning}" > This is the output in both Zsh and Ksh (ignore leading whitespace): > 'good morning
In bash, nested quotes within dollar-bracket expansions introduce a new quoting context, and bash requires that the quotes be matched. This is in effect whether or not the expansion is enclosed in double quotes. That is how I interpreted these portions of Posix: "Within the string of characters from an enclosed "${" to the matching '}', an even number of unescaped double-quotes or single- quotes, if any, shall occur." and "The matching closing brace shall be determined by counting brace levels, skipping over enclosed quoted strings, and command substitutions." There was a discussion about this on the Posix working group mailing list last spring, and the first quote above was deemed a requirement on the application, not the shell, and the second was discarded as "completely wrong." The result was an interpretation that declared that single quotes have no special meaning within expansions enclosed in double quotes. Bash-4.2 will change Posix mode to comply with the new Posix interpretation. By default, it will behave as it always has. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/