[LTP] [PATCH 1/3] tst_test.sh: Simplify tst_cmd_available()
Petr Vorel
pvorel@suse.cz
Wed Aug 18 11:40:53 CEST 2021
Hi Joerg,
...
> > + type $1 >/dev/null 2>&1
> I guess there was a reason, why command was used here in the first place.
> Iirc type is often a shell builtin, that can have different behavior, while
> command -v is posix and should be extremely portable.
> So maybe it is better to use "command -v" instead of type here. I hope most
> distributions have a command-command...
Well, I wrote that code, in dba1d50cb :). IMHO both are POSIX and both are shell
builtin.
I tested it on all implementations and the only difference is that both "type"
and "command -v" on dash and busybox sh returns 127 on missing command, the rest
return 1.
Kind regards,
Petr
More information about the ltp
mailing list