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

Re: can print but not assign to variable



On Wed, Oct 26, 2022, at 8:00 PM, Ray Andrews wrote:
>> With EXTENDED_GLOB enabled, "#i" is treated as a glob, but this
>> fails because it is an invalid pattern.
>>
>> 	% setopt EXTENDED_GLOB
>> 	% var=(#i)$cmd
>> 	zsh: bad pattern: #i
>>
> I crashed into that.  Sheesh, there's one case where EXTENDED_GLOB is 
> limiting.  Very confusing.

EXTENDED_GLOB has nothing to do with it.  The problem is that

    var=(#flags)pattern

is not parsed the way you think it should be, and it ends up being
a different command altogether, regardless of the state of
EXTENDED_GLOB.  (Notice that my NO_EXTENDED_GLOB example *does not
work* -- it just quietly does something unintended.)

-- 
vq




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