TIL: command -v is the POSIX way to do which
While perusing the password-store git log,
I came up with this commit, where I learned
that POSIX defines the shell internal command command -v
,
which behaves like the external command which
(that locates the absolute path to an executable, by tracing PATH
).
The existence of the internal command (supported by bash
, dash
and fish
, at least)
is beneficial for writing more efficient shell scripts.
Tags
POSIX
shell