doc
This commit is contained in:
@@ -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))
|
||||
```
|
||||
Reference in New Issue
Block a user