Re: shell "if"



Morten Welinder wrote:

Someone has started using a bash incompatibility a lot in gnome2
sources.  This is not good.  Here's a line (from atk's configure,
I think -- it's all over).

    if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7.0; then

The *proper* meaning of that is to execute the command "!" with
three arguments, but bash takes in upon itself to define it as
the negation of the $PKG_CONFIG call with two arguments.  (This
was probably meant as an extension of the language, but clearly
isn't.)

Can we please stop using non-standard shell stuff?

The following should be a safe alternative:
 $PKG_CONFIG --atleast-pkgconfig-version 0.7.0
 if test $? -ne 0; then
   ...

James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]