diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 0000000..da40b8c --- /dev/null +++ b/doc/index.md @@ -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)) +```