On Mon, Dec 20, 2010 at 10:38:11AM -0800, Curtis Doty wrote:
> The workaround of using ((++i)) seems to work.
What if i starts at -1?
> Sounds like this is a FAQ.
I have a page at http://mywiki.wooledge.org/BashFAQ/105 in fact.
11:30am Eric Blake said:
On 12/20/2010 11:25 AM, Curtis Doty wrote:
Not exactly sure if this is a bug. But I don't understand why only the
first time running ((i++)) returns an error exit status.
Because it follows the same semantics as 'expr', where status 1 is
reserved for a successful run
On 12/20/2010 11:25 AM, Curtis Doty wrote:
> Not exactly sure if this is a bug. But I don't understand why only the
> first time running ((i++)) returns an error exit status.
Because it follows the same semantics as 'expr', where status 1 is
reserved for a successful run with value 0, and status 2
Not exactly sure if this is a bug. But I don't understand why only the
first time running ((i++)) returns an error exit status.
Here's my script:
#! /bin/bash
echo $BASH_VERSION ${BASH_VERSINFO[5]}
set -x
#set -e
i=0
((i++))
echo $?
((i++))
echo $?
And here's what the output looks like:
4.1.7