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

Re: whence question



On Sat, 14 Jan 2017, Ray Andrews wrote:

> > $ unsetopt nullglob; unsetopt nonomatch; whence -ma grub-r*
> > $ unsetopt nullglob; setopt nonomatch; whence -ma grub-r*
> > $ setopt nullglob; setopt nonomatch; whence -ma grub-r*
> > $ setopt nullglob; unsetopt nonomatch; whence -ma grub-r*
>
> Does that contradict? Nuthin' works.

The options you're changing only matter when globbing FAILS.  If the
local file matching grub-r* exists, then globbing SUCCEEDS, and your
option changes mean nothing in context.

Try adding "unsetopt glob" to the mix (though you'd never want that in
regular usage).

> Just being devil's advocate here of course but in this case does not the
> 'm' switch in effect 'state' an exception?  That is, is it not an
> explicit request to change the rules vis a vis globing?

No, it isn't, because globbing is done by the shell long before it tries
to execute the "whence" (or any other) command, so at the time globbing
is done "-m" is just another syntactic word with no special meaning.

I'm pretty sure you and I have had this conversation before.  This isn't
like the old DOS shell where the arguments get passed verbatim and it is
up to the command to invoke the standard pattern matcher.  The order of
operations is different.



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