From af055bcaa6993566dfb8f6f984c1896962fd02a0 Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 29 Jul 2026 18:31:58 +0400 Subject: [PATCH] doc --- doc/index.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 doc/index.md 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)) +```