bug-bash
[Top][All Lists]
Advanced

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

Re: i++ cause bad return code when result is 1


From: Chris Down
Subject: Re: i++ cause bad return code when result is 1
Date: Tue, 27 Aug 2013 03:45:56 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-08-26 21:36, David Lehmann wrote:
> My issue is that the resulting behavior in Exercise 1 does not make sense.
> 
> The resulting value of i should have no bearing on the exit code.  If the
> addition succeeded, the expression should return 0 (success).  If i was not
> an integer (e.g. i=hello), then I expect (( i++ )) to return a non-zero
> error code.
> 
> ...IMHO, of course.

That would be pretty much rewriting the entire way that (( works, since the
whole point is that it returns a status based upon having a return value that
is >0. Compare:

    $ (( 0 )); echo "$?"
    1
    $ (( 1 )); echo "$?"
    0

Attachment: pgpDDklPNa28C.pgp
Description: PGP signature


reply via email to

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