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

RE: PATCH: parameter and quoting (was: Re: Completion problems.)



> Then Andrej Borsenkow wrote:
>
> > Unfortunately, Single UNIX requires, that quotes be matched. This
> is from the
> > description of double-quotes:
> >
> > ==
> > 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.
> > ==
> >
> > It means, that preceding example MUST be
> >
> > echo "${a%\'}"
>
> Damn, I just had the patch... but even if we decide to follow the
> standard and not ksh here, it will be easier with this patch.
>

Ehem ... reading it a bit more closely, it is still ambiguous. Single UNIX
explicitly diallows "${foo%'}" - but it does not tell us, how to actually escape
single quote in this case. Another line in the same paragraph says:

==
The backslash retains its special meaning as an escape character (see Escape
Character (Backslash) ) only when followed by one of the characters:
$   `   "   \   <newline>
==

OTOH it contains valid example:

unset bar
foo="${bar-\}}"

This implies, that in "${...}" backslash quotes } and (probably) ' ... horrors.

Anybody has better description?

/andrej



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