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: DJ Mills
Subject: Re: i++ cause bad return code when result is 1
Date: Tue, 27 Aug 2013 14:33:01 -0400

On Mon, Aug 26, 2013 at 9:36 PM, David Lehmann <
address@hidden> 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.
>
>
Then what do you expect to happen for i=0; if ((i)); then echo "hi"; fi ?

Making the value of i not affect the exit status would make (( practically
worthless for most things


reply via email to

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