Re: process result code in if

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

 



Tim Rice <tim@xxxxxxxxxxxxxxxx> 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

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux