mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Adds note, and solution, for error code when incrementing from 0
to 1
@@ -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.
|
||||
|
Reference in New Issue
Block a user