Is double square brackets [[ ]] preferable over single square brackets [ ] in Bash?
[[ has fewer surprises and is generally safer to use. But it is not portable – POSIX doesn’t specify what it does and only some shells support it (beside bash, I heard ksh supports it too). For example, you can do to test whether a file exists. But with [, you have to quote $b, … Read more