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
for i in 1 2 3 4; do
while [[ true ]]; do
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
This is fantastic! I’m still new to bash scripting :) but will include this in the article. Great feedback!!
I have updated the post, thank you again for the feedback!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.