Re:Which is not Posix
by jonnycomputer on Monday November 01, 2021 @03:34PM
(#29071846)
On Mac, with an alias I don't get the same answer from the two anyway:
[ Parent
| on HN ]
Correct, because they do two different things.
`which` is a standalone executable which searches the environment's PATH for the named command. It doesn't know about commands which aren't executables (i.e. builtins and aliases).
`command` is a shell builtin which tells you exactly what that shell in its current state would run.
Re:Which is not Posix
by jonnycomputer on Monday November 01, 2021 @08:08PM
(#29075142)
Interesting, and useful to know. Thanks for that.
That happens on every system I believe. It does for my RHEL boxes anyway. That also isn't the behavior I am looking for so I will stick with "which".
Re:Which is not Posix
by jonnycomputer on Monday November 01, 2021 @08:04PM
(#29075101)
I suspected it might, but was too lazy to check. Thanks for doing that.