Incrementing a variable var works in bash when enclosed in double parentheses like (( var++ )). But I have found that it fails if variable is set to 0 beforehand like var=0.
$ a=0
$ ((a++)) && echo "command succeeded" || echo "command failed"
command failed
$ a=1
$ ((a++)) && echo "command succeeded" || echo "command failed"
command succeeded
Can someone explain this behavior?
Environment:
I am using gnome-terminal on Ubuntu Desktop 18.04.5 LTS.