This commit is contained in:
pvincent
2026-07-29 18:31:58 +04:00
parent 9ee5e49e74
commit af055bcaa6
+38
View File
@@ -0,0 +1,38 @@
# Documentation
## prevent last false
function body should not end up with a ternary statement
### wrong last
Compound of 2 'false' statement returns false.
```bash
[[ : ]] && [[ : ]]
```
### right last
```bash
[[ : ]] && [[ : ]] || true
```
## arithmetic issue
last (++) statement does not complete successfully!
### wrong ++
```bash
count=0
(( ++count )) # ok
(( ++count )) # last statement in function returns false
```
### right ++
```bash
count=0
count=$((count+1))
```