Instead of referring to some online articles on test conditions, you can just check out man test.
Conditions and most other such things are good to shorthand a bit, and if you're planning on using BASH use [[ ... ]] instead of [ ... ] as they also function differently. Stick to one style for predictability. serverfault.com/a/52050
Slightly compacted formats
if[["$FOO"=="1"]];then
...
else
...
fi
for i in 1 2 3 4;do
echo$idone
while[[true]];do
...
done
Also shellcheck.net/ is an excellent resource to use to check your scripts for common bugs etc. There's even a decent unit testing framework for BASH scripts nowadays: github.com/sstephenson/bats
Lead Developer: Adobe Experience Manager.
Father of one.
Minnesota.
Occasionally write here: ahmedmusallam.com and there: https://blogs.perficientdigital.com/author/amusallam/
Lead Developer: Adobe Experience Manager.
Father of one.
Minnesota.
Occasionally write here: ahmedmusallam.com and there: https://blogs.perficientdigital.com/author/amusallam/
Instead of referring to some online articles on test conditions, you can just check out
man test
.Conditions and most other such things are good to shorthand a bit, and if you're planning on using BASH use
[[ ... ]]
instead of[ ... ]
as they also function differently. Stick to one style for predictability. serverfault.com/a/52050Slightly compacted formats
Also shellcheck.net/ is an excellent resource to use to check your scripts for common bugs etc. There's even a decent unit testing framework for BASH scripts nowadays: github.com/sstephenson/bats
I have updated the post, thank you again for the feedback!
This is fantastic! I’m still new to bash scripting :) but will include this in the article. Great feedback!!