On Tue, 2026-03-10 at 00:21 +0900, Osamu Aoki wrote:
> I guess you have different which ...
17:38 antoine@yoga ~% which which
which: shell built-in command
Looks like which (== whence) is one of the zsh built-in commands. So it
doesn't actually invoke the which binary.
https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html
which [ -wpamsS ] [ -x num ] name ...
Equivalent to whence -c.
whence [ -vcwfpamsS ] [ -x num ] name ...
-s If a pathname contains symlinks, print the symlink-free
pathname as well.
I'm pretty sure there's a well known way to deal with it ... but I
don't know what it is :-)
In case it's helpful, according to Opus-4.6: The issue is that which -s
(silent mode) is a feature of the standalone /usr/bin/which, but zsh's
built-in which doesn't support -s the same way. The most portable fix
is to replace which -s with command -v ... >/dev/null 2>&1, which is
POSIX-compliant and works identically across all shells (dash, bash,
zsh).