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

Re: whence (was Re: local unfunction)



On 31/03/18 06:18 PM, Bart Schaefer wrote:

What's with the extra ":" there?  Is there actually a colon in the file name?
It's deliberate abuse, I tried all sorts of things to see what might work and what might break.  It seems there's nothing in my issues that's  directly caused by some sort of weird naming .
-m # find all matches of a pattern, subsumes '-a' (executable ONLY unless

I meant it might be so not that it is so.
This being a proposed new flag.  I think this points to the source of
the confusion.  The command hash table will contain the first
occurrence of every file name from every directory in $path, even if
that first occurrence is not executable, and "whence -m" will show you
all of the matching entries in the hash table.  The existing -m option
subsumes your -t.

The other confusion is that -m never searches $path.  It always
populates the command hash table if necessary and then searches the
hash table.
I dunno Bart, it all seems so counter intuitive.  Maybe it's just me, but my 'interpretation' seems the natural one.  It seems absolutely robust as far as aliases and functions and everything but files, but with files, one never knows what might be found.  At the very least the docs could be a bit more clear.  But as I said, I seem to be the only one chaffing about this so I'll use other means to find matching files on the path and make a clear distinction between executables and non executables.  The output of my wrapper, unverbose, looks like this:

$ i "zsh*"

146:: (1)TYPE: /aWorking/Zsh/Source/Wk/zsh is an unexecutable script or text file 146:: (2)TYPE: /aWorking/Zsh/System/zsh is an unexecutable script or text file 146:: (3)TYPE: /aWorking/Bin/zsh5.3.txt is an unexecutable script or text file
196:: (1)TYPE: zsh is /usr/local/bin/zsh -> /aWorking/Bin/zsh5.3:
196:: (2)TYPE: zsh is /usr/bin/zsh -> /aWorking/Bin/zsh5.3:
196:: (3)TYPE: zsh is /bin/zsh -> /aWorking/Bin/zsh5.3:

... it finds every damn thing every time no buts or maybes and I'm expecting it to work in April too except when the moon is waning ;-)

$ i grep

196:: (1)TYPE: GREP is an alias for grep $g_nocase --color=auto:
196:: (2)TYPE: grep is /bin/grep:

$ i echo

196:: (1)TYPE: echo is a shell builtin:
196:: (2)TYPE: echo is /bin/echo:





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