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

Re: whence output varies with dot vs. realpath in $PATH

On 2022-10-31 17:31, Bart Schaefer wrote:

No.  -m means to find all the names (in any hash table) that match a
pattern.  -a means to show all the occurrences in $path of each name
(either literally without -m, or found in the command hash table by
-m).  -m happens first, and then -a searches the path.
That's a better explanation right there than in the docs.  I was only saying how I think it should work, how it *does* work is only now made clear.

Whether a full path appears there depends on how the function was
defined.  The only way you get the output with "... from ..." but
without the full path is if you source the function from a file in the
current directory (e.g., "source rap").

Ah!  so the full path information isn't even retained anywhere. Once it's in memory it doesn't matter.  But if I do this:

2 /aWorking/Zsh/Source/Wk 5 $ . $(realpath ./rap)

... whence shows me this:

rap is a shell function from /aWorking/Zsh/Source/Wk/rap

... because the full path is actually available at the time of sourcing.  There is always a way.

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