Usually i only use [[ for all kinds of test cases, because it\'s the most advanced way and it\'s more safe to use (Regex, ...). I know that [[ executes different code than [
Quoting. You have to quote variables that you use in [:
[
$ VAR= $ [ -n $VAR ] $ echo $? 0 $ [ -n "$VAR" ] $ echo $? 1