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

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

On Mon, Oct 31, 2022 at 7:57 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Yeah I noticed but I think our situations are different.  I'll bet you
> can duplicate my output if you tinker with your path. Sheesh, what else
> could it be?

It's the -m option.  If you ask for a pattern match, "whence" rebuilds
the internal command hash table from the path and then does the
matching against that.  However, "." is never used when loading the
hash table because it would become invalid as soon as you change
directories.  If $PWD is actually in the path, then those commands DO
get put in the hash table, so whence reports them.  This should
probably be clarified in the documentation -- whence never does
globbing on actual file names.

You don't see this as a persistent condition because you're running
"whence" in a subshell with $(...).

The "zsh is zsh" output means you have an empty path element, e.g. two
consecutive colons in $PATH or $PATH begins or ends with colon, and an
executable or link named "zsh" in the current directory.

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