[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inconsistent exit status of ((count++))
From: |
Stefano Lattarini |
Subject: |
Re: inconsistent exit status of ((count++)) |
Date: |
Fri, 30 Jul 2010 22:03:58 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
At Friday 30 July 2010, Greg Wooledge wrote:
> 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,
Well, I wasn't really advocating a change here, since I've never had
problems with the current behaviour; I was just pointing out that
it is suboptimal.
> it would be to make them crash the script instead of
> letting bash continue.
This makes sense; now I think that, if there's going to be a change,
it should be on the lines proposed by you.
Regards,
Stefano