On Mon, Nov 23, 2020 at 07:36:29PM +0000, Jetzer, Bill wrote: > The prefix and postfix versions of the increment (++) and > decrement (--) operators return a non-zero exist status when the varable's > value is zero. This causes scripts to terminate if `set -e` is used
https://mywiki.wooledge.org/BashFAQ/105 Exercises 1 and 2 apply directly. Everything else on the page applies too, more broadly. You may need to read it several times to start to undo the damage you've already suffered.