documentation rewritten

This commit is contained in:
pvincent
2026-08-10 17:37:32 +04:00
parent 13a5d98c8a
commit c14acaf6d0
5 changed files with 83 additions and 61 deletions
+38
View File
@@ -0,0 +1,38 @@
# Bash Tips
## 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))
`