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

Bjørn Forsman bjorn.forsman at gmail.com
Mon Jan 27 20:01:27 UTC 2014


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.

Best reagards,
Bjørn Forsman



More information about the buildroot mailing list