Re: shell "if"
- From: Owen Taylor <otaylor redhat com>
- To: James Henstridge <james daa com au>
- Cc: Morten Welinder <terra diku dk>, gnome-hackers gnome org
- Subject: Re: shell "if"
- Date: Wed, 30 Jan 2002 00:25:54 -0500 (EST)
James Henstridge <james daa com au> writes:
> 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
> ...
I think the traditional
if $PKG_CONFIG --atleast-pkgconfig-version 0.7.0 ; then : ; else
do something
fi
Is probably a little nicer.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]