This will explain:
((0))
echo $?
1
((1))
echo $?
0
Thus, due to the nonzero return status, the evaluation of an arithmetic expression in (( and ))your script exits when used set -e.
As the help setfollowing says:
-e Exit immediately if the command exits with a non-zero status.
source
share