warning about which deprecated

Bastian Bittorf bb at npl.de
Sun Nov 7 23:44:02 PST 2021


On Sun, Nov 07, 2021 at 10:25:48PM -0800, Rosen Penev wrote:
> > > Should we consider building it as a toolchain tool or should we migrate to
> > > command -v ?
> > https://github.com/openwrt/openwrt/commit/1f5e7224868109a170a9248d18f8d2b6124e9c5a
> Wonder if switching command -v to type -a -p makes sense.

Is seems to be not portable using '-a -p':

At least it is also POSIX and builtin:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
(but no commandline switches!)

it works the way you describe it on debian,
but not on e.g. OpenWRT:

root at F36-stube:~ ls -l /bin/foo /usr/sbin/foo
-rwxr-xr-x    1 root     root            16 Nov  8 08:31 /bin/foo
-rwxr-xr-x    1 root     root            16 Nov  8 08:31 /usr/sbin/foo

user at box:~ which -a foo
/usr/sbin/foo
/bin/foo
/usr/sbin/foo

root at F36-stube:~ type -a -p foo
/usr/sbin/foo
# here the returncode is != 0

bye, bastian



More information about the openwrt-devel mailing list