Bash exit status of shorthand increment notation
a++ is post-increment: it increments after the statement is evaluated. By contrast, ++a increments before. Thus: $ a=0 ; ((a++)) ; echo $a $? 1 1 $ a=0 ; ((++a)) ; echo $a $? 1 0 In the first case, ((a++)), the arithmetic expression is evaluated first, while a is still zero, yielding a value … Read more