autoconf
[Top][All Lists]
Advanced

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

Re: process result code in if


From: Miles Bader
Subject: Re: process result code in if
Date: Sat, 08 Jun 2013 07:11:08 +0900

Tim Rice <address@hidden> writes:
> On Fri, 7 Jun 2013, A.P. Horst wrote:
>> if ! test $var -gt 0 > /dev/null 2>&1; then
>
> "if ! test ..."  is definitely not portable.

Hmmm, I can never remember which is the portable one, but from the
autoconf docs, one should usually use "if test ! ..." instead :

     It is safe to use `!' as a `test' operator.  For example, `if
     test ! -d foo; ...' is portable even though `if ! test -d foo;
     ...' is not.

However in this case, because he wants specific behavior for the case
where test gives a syntax error, I guess it's better to instead use
"if test ... then : ; else ..."

><

-miles

-- 
The secret to creativity is knowing how to hide your sources.
  --Albert Einstein



reply via email to

[Prev in Thread] Current Thread [Next in Thread]