Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: pws-19: minor syntactic innovation



>
> This isn't due to the change I made, it simply showed up because of that.
> The cause is dquote_parse(), which is doing brace-counting; in
> other words,
> it rejects the second `"' as the end of the quoted string because it
> detected the ${.  So this behaviour seems to be entirely deliberate.
>

I beg your pardon, I was just too eager. Looking more closely in Single Unix
reveals:

The dollar-sign retains its special meaning introducing parameter expansion
(see Parameter Expansion ), a form of command substitution (see Command
Substitution ), and arithmetic expansion (see Arithmetic Expansion ). The
input characters within the quoted string that are also enclosed between
"$(" and the matching "(" will not be affected by the double-quotes, but
rather define that command whose output replaces the $(...) when the word is
expanded. The tokenising rules in Token Recognition are applied recursively
to find the matching ")". Within the string of characters from an enclosed
${ to the matching "}", an even number of unescaped double-quotes or
single-quotes, if any, must occur. A preceding backslash character must be
used to escape a literal "{" or "}". The rule in Parameter Expansion will be
used to determine the matching "}".

In other words, Zsh (and bash) both behave "POSIXLY-correct" at least in the
respect to correct expressions.


/andrej



Messages sorted by: Reverse Date, Date, Thread, Author