>Description:
>        The shorthands "++", "--", "+=1" and "-=1" in bash arithmetic
>erroneously return exit code 1 when a variable is either incremented by
>"++" or decremented by "--" from 0 or incremented by "+=1" or decremented
>by "-=1" from -1 and 1 respectively, although the variable value changes
>properly.

This is documented, so not a bug.  Maybe post to help-bash?

It might even be required by POSIX.

Basically, both "let" and "(( ))" are documented as returning a non-zero exit 
status
if the result of the computation is zero (sounds weird, when you say it like 
that,
doesn't it?)

BTW, and only tangentially related, "man bash" says that "let" and "(( ))" are 
exactly
the same, but "shellcheck" thinks otherwise.  "shellcheck" says you should use 
"(( ))"
and never use "let", but I still (mostly) use "let".


Reply via email to