[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]
From: |
Greg Wooledge |
Subject: |
Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"] |
Date: |
Fri, 13 Jun 2025 10:13:31 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Fri, Jun 13, 2025 at 07:57:54 -0600, Stan Marsh wrote:
> Also, note that if you are running with "set -e" (or "trap ... ERR"), then
> having
> "let" (or "(( ))") return a non-zero exit status when it happens to evaluate
> to zero,
> could cause an unexpected script abort.
This is why I linked to <https://mywiki.wooledge.org/BashFAQ/105#Exercises>
which calls out precisely that issue. The whole page is dedicated to
set -e and the problems that it creates.
- [bash arithmetic bugs with "++","--","+=1" and "-=1"], Stamatis Mavrogeorgis, 2025/06/13
- Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"], Stan Marsh, 2025/06/13
- Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"], Stan Marsh, 2025/06/13
- Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"],
Greg Wooledge <=
- Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"], Stan Marsh, 2025/06/13