bug-bash
[Top][All Lists]
Advanced

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

Re: inconsistent exit status of ((count++))


From: Andrew Benton
Subject: Re: inconsistent exit status of ((count++))
Date: Fri, 30 Jul 2010 19:33:00 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b3pre) Gecko/20100728 Shredder/3.2a1pre

On 30/07/10 19:55, Stefano Lattarini wrote:
At Thursday 29 July 2010, Andrew Benton wrote:

andy:~$ count=0
andy:~$ ((count++))
andy:~$ echo $?
1
andy:~$ ((count++))
andy:~$ echo $?
0
I don't think it's a bug, it's just an effect of:
   1. `((EXPR))' returning a non-zero exit status iff EXPR evaluates
      to zero, and
That makes no sense to me. Why would evaluating an expression have a non-zero exit status if there was no error? That makes the exit status no use at all for evaluating whether an error has occurred. How can I check for errors if I can't rely on the exit status? How can that not be a bug?

Andy



reply via email to

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