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

Re: ${${~:-*}//(#m)*/$MATCH=$MATCH} fails



On 9/12/06, Peter Stephenson <pws@xxxxxxx> wrote:
"Nikolai Weibull" wrote:
> Try the above with an echo.  In zsh 4.3.2, this will give you an
> illegal UTF-8 character, an equal sign, and another illegal UTF-8
> character.  Is $MATCH accessing uninitialized memory?  Or am I doing
> something wrong?

Neither: the pattern matcher is being passed a tokenized string as the
test string for matching.  This doesn't make sense, particularly since
the pattern matcher assumes the string can be metafied, which is what is
messing up the characters.  The easy fix is just to untokenize all test
strings at that point (the pattern string needs tokens, of course).

This stops the "*" being active at that point, although it's eligible
for the effect of a ~ in the context further out.  What I mean is,

% foo="*
% print ${${~foo}/\*/*}
*
% print ${~foo/\*/*}
<list of files>

Hm.  My intent doesn't seem to have been clear.  What I want it to do
is print a list of files where each file is followed by an equal sign
and the file again.  This is for passing args to mkisofs with the
-graft-points option.

 nikolai



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