The tests you had listed :
- Single Parenthesis – ( … ) is creating a subshell
- Double Parenthesis – (( … )) is for arithmetic operation
- Single Square Bracket – [ … ] is the syntax for the POSIX
test - Double Square Brackets – [[ … ]] is the syntax for bash conditional expressions (similar to
testbut more powerful)
are not exhaustive, you can use boolean logic
if command; then ...
too, because the commands have exit status. In bash, 0 is true and > 0 is false.
You can see the exit status like this :
command
echo $?
See :
http://wiki.bash-hackers.org/syntax/basicgrammar
http://wiki.bash-hackers.org/syntax/arith_expr
http://mywiki.wooledge.org/BashGuide/TestsAndConditionals