[Buildroot] [PATCH 1/1] Prefer 'command -v' over 'which' (for portability)

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon Jan 27 20:32:28 UTC 2014


On Mon, Jan 27, 2014 at 9:01 PM, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
> On 27 January 2014 10:19, Samuel Martin <s.martin49 at gmail.com> wrote:
>> Bjørn, all,
>
> [...]
>
>> "command -v" seems not playing very well with aliases:
>>
>> $ command -v make
>> alias make='~/.config/ctafconf/bin/colorwarper make'
>> $ which make
>> /usr/bin/make
>
> Ah, correct.
>
> There is "type -P" which is more like "which" in that regard, but the
> "-P" option doesn't seem to be specified by POSIX. For example, "type
> -P which" fails in dash.
>
> Instead of an alias, you could write a one-liner shell wrapper? I tend
> to prefer wrappers over aliases anyway, because of issues like these;
> aliases sometimes behave differently than proper commands.

Why I also think this is saner than aliases, we cannot dictate this
principle to all buildroot users, so buildroot cannot rely on aliases
not being used...

Best regards,
Thomas



More information about the buildroot mailing list