[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: increment & decrement error when variable is 0
From: |
Greg Wooledge |
Subject: |
Re: increment & decrement error when variable is 0 |
Date: |
Mon, 23 Nov 2020 17:20:22 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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.