[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inconsistent exit status of ((count++))
From: |
Greg Wooledge |
Subject: |
Re: inconsistent exit status of ((count++)) |
Date: |
Fri, 30 Jul 2010 15:53:54 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Jul 30, 2010 at 09:49:22PM +0200, Stefano Lattarini wrote:
> But then, maybe an exit status of `2' instead of `1' in case of errors
> in ((...)) would be helpful -- currently the exit status is still `1'
> also if a real error is present:
>
> $ ((1+)); echo \$?=$?
> bash: ((: 1+: syntax error: operand expected (error token is "+")
> $?=1
Most syntax errors cause the shell to abort right then and there, when in
non-interactive mode. Syntax errors inside an arithmetic context don't,
which is already weird. If I were going to ask for a change, it would
be to make them crash the script instead of letting bash continue.