<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 18, 2021 at 5:41 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Joerg,<br>
<br>
...<br>
> > +   type $1 >/dev/null 2>&1<br>
> I guess there was a reason, why command was used here in the first place.<br>
> Iirc type is often a shell builtin, that can have different behavior, while<br>
> command -v is posix and should be extremely portable.<br>
> So maybe it is better to use "command -v" instead of type here. I hope most<br>
> distributions have a command-command...<br>
Well, I wrote that code, in dba1d50cb :). IMHO both are POSIX and both are shell<br>
builtin.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Another reason, I guess, is `command -v ` looks to match the function name more:).</div><div class="gmail_default" style="font-size:small">But it depends on you, I'm OK with any of them.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>> </div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I tested it on all implementations and the only difference is that both "type"<br>
and "command -v" on dash and busybox sh returns 127 on missing command, the rest<br>
return 1.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Sounds great!</div></div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>