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

Re: whence question

On 13/01/17 09:11 PM, Bart Schaefer wrote:
On Fri, 13 Jan 2017, Ray Andrews wrote:

Is this to be expected:

    $ touch grub-r

    $ whence -ma grub-r*

To expound a little on Daniel's answer, touching the file has made
"grub-r*" into a pattern that generates a file name, so instead of looking
for all commands matching the pattern you're looking for all commands
matching the name of the file -- of which there are none.
I roughly understand that. I know that if a glob has no match it's passed verbatim so whence sees what it's supposed to see, but the fact that there is a match fouls that up. It's a bit of a bother but I can see that without 'noglob' the shell's zeal for expanding globs is in more or less direct conflict with the intention of the 'm' switch which supposes that whence will handle globing itself. I can also see that that might not be fixable even in theory for reasons of consistency, OTOH I can also speculate that whence might have this noglob built into it automatically whenever the 'm' is used so that there is no conflict -- but that might not be possible without the alias. Certainly what happens is a bit of a gotcha, the incidental local match surely should not matter. Shouldn't 'm' have complete control of globing, since that's what it's for? Dunno, could/should whence be an alias by default? or, since whence is a builtin, might it be possible to prevent the globing in the first place? I understand that that wouldn't be possible with an external command but since it's in the family a bit of hokey pokey might be possible. Sorta whence prepending 'noglob' to itself automatically. Or maybe that's a really dumb idea.

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