On Fri, Dec 12, 2025 at 8:39 AM Mark J. Reed <markjreed@xxxxxxxxx> wrote:
>
> Why does the "command not found" output of `which` go to stdout?
The most recent discussion of this starts at workers/43523 from 2018,
at which point it was added to Etc/FAQ question 3.29.
! My bad for not checking the FAQ; it did not even occur to me as a thing that would conceivably be there!
So the answer is "because csh did it that way and that's where zsh got the 'which' command". Well, I guess that's why zsh also borrowed `whence` from ksh, which behaves more sensibly here.
I guess a consistent cross-shell approach here would be to use `type`, check the return code, and extract the pathname from the end of the message on success.