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

Yann E. MORIN yann.morin.1998 at free.fr
Sat Feb 15 11:44:18 UTC 2014


Arnout, All,

Jumping back into this old thread, after it was referenced by Maxime in
his XBMC series...

On 2014-01-28 07:54 +0100, Arnout Vandecappelle spake thusly:
> On 27/01/14 10:19, Samuel Martin wrote:
> >"command -v" seems not playing very well with aliases:
> >
> >$ command -v make
> >alias make='~/.config/ctafconf/bin/colorwarper make'
> >$ which make
> >/usr/bin/make
> 
>  I don't think your .profile gets executed when running a shell script, so
> the alias will not be set. Bash does use BASH_ENV to specify a startup
> script, so perhaps we should unexport that.

Here is a little test I did:

    $ cat Makefile
    all:
        echo "'$${buz}'"
        foo

    $ cat /tmp/foo.env
    buz="BUZ"
    echo BAR
    alias foo='echo FOO'

    $ BASH_ENV=/tmp/foo.env ENV=/tmp/foo.env make
    echo "'${buz}'"
    ''
    foo
    make: foo: Command not found
    make: *** [all] Error 127

So, it looks like neither BASH_ENV nor ENV are parsed (ENV is for when
bash is invoked in POSIX mode).

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list