From d687b2d0238a9e6295e4758d85d91a9717317dc1 Mon Sep 17 00:00:00 2001 From: S0AndS0 Date: Mon, 2 Nov 2020 01:20:13 +0000 Subject: [PATCH] Adds note, and solution, for error code when incrementing from `0` to `1` --- SC2219.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SC2219.md b/SC2219.md index c23b4fd..d5ce9c3 100644 --- a/SC2219.md +++ b/SC2219.md @@ -9,8 +9,11 @@ let a++ ### Correct code: ```sh -(( a++ )) +(( a++ )) || true ``` + +> Note, `|| true` bits ignore error status code when incrementing from `0` to `1` + ### Rationale: The `(( .. ))` arithmetic compound command evaluates expressions in the same way as `let`, except it's not subject to glob expansion and therefore requires no additional quoting or escaping.