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

RE: ${...%%=*} problem



>
> > bor@itsrm2% print ${foo%%=*}
> > zsh: * not found
> >
> > Why?
>
> Because it does expansion, include the one after an equal sign:
>

This violates our own documentation:

They are followed by _process
substitution_, _parameter expansion_, _command substitution_,
_arithmetic expansion_ and _brace expansion_ which are performed in one
step in left-to-right fashion.  After these expansions, all unquoted
occurrences of the characters `\', `'' and `"' are removed, and the
result is subjected to _filename expansion_ followed by _filename
generation_.

and later

If a word begins with an unquoted `=' and the EQUALS option is set, the
remainder of the word is taken as the name of a command or alias.  If a
command exists by that name, the word is replaced by the full pathname
of the command.

Granted, we do not have strict definition of ``word'' (as opposed to POSIX
:-). In this context I suspect it more like POSIX ``field''. Still, =
expansion happens after parameter substitution - not at the same time (and,
actually, here it happens even before).

-andrej



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