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

Re: whence (was Re: local unfunction)



On Wed, Apr 4, 2018 at 11:10 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Let me rephrase.  In your example:
>
>> > > % path=(./Src $path)
>> > > % whence zsh
>> > > ./Src/zsh
>> > > % whence -a zsh
>> > > ./Src/zsh
>> > > /bin/zsh
>> > > % whence -m zsh
>> > > /bin/zsh
>> > > %
>
> why do 'whence' and 'whence -m' give different results?  Isn't one or the other
> wrong?

It could be argued that "whence -m" is inaccurate, yes, but that's
because "." and other relative locations in $PATH are weird, not
because the command hash table is out of date.

It's important to note that "whence -m" is doing pattern matching on
strings, not filename generation.  It's not meant to search for files
in $PATH, it's meant to do "hash -m ..." for all possible
command-position hash tables in one go.  Most of what else it does, it
does because somebody complained that every line of output wasn't
uniformly formatted.



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