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

Re: whence (was Re: local unfunction)



On 04/04/18 05:20 PM, Bart Schaefer wrote:

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

But what is the real world relevance of 'hash -m'?  From almost the beginning of my experience with Linux and zsh one has the need to know what " $ [command] ENTER " is likely to do, especially in tricky situations where there  are scripts and aliases and links and functions and builtins and files that might share the same name.  One is pointed to whence as the utility that answers that question, but it does not answer it accurately when it comes to files.  One way or another, the dot directory is simply mishandled, I think that's inescapable.  And the other strange things might seem rational as far as the hash table goes, but they sure aren't rational as far as using whence for what everyone says it is supposed to do and which it almost does do except for the anomalies -- find things that execute.  Perhaps whence should be left as a curiosity and another builtin developed that does what I think whence should do and what needs to be done -- show everything executable named [PATTERN] ... all the time.  The pie can be sliced into three clearly understandable, non overlapping pieces: 1) Non-file stuff: aliases, builtins, etc. 2) Executable files and links on the path.  3) Non executable files on the path that zsh will search for in case of " $ source [name] ".  Patterns matched if patterns supplied.  Throw in a few verbosity levels and that's that.  It could be so simple.




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