Adding context to hopefully help provide a bit of additional clarity on this subject. To a BaSH newbie, it's sense of true/false statements is rather odd. Take the following simple examples and their results.
This statement will return "true":
foo=" "; if [ "$foo" ]; then echo "true"; else echo "false"; fi
But this will return "false":
foo=" "; if [ $foo ]; then echo "true"; else echo "false"; fi
Do you see why? The first example has a quoted "" string. This causes BaSH to treat it literally. So, in a literal sense, a space is not null. While in a non-literal sense (the 2nd example above), a space is viewed by BaSH (as a value in $foo) as 'nothing' and therefore it equates to null (interpreted here as 'false').
These statements will all return a text string of "false":
foo=; if [ $foo ]; then echo "true"; else echo "false"; fi
foo=; if [ "$foo" ]; then echo "true"; else echo "false"; fi
foo=""; if [ $foo ]; then echo "true"; else echo "false"; fi
foo=""; if [ "$foo" ]; then echo "true"; else echo "false"; fi
Interestingly, this type of conditional will always return true:
These statements will all return a result of "true":
foo=""; if [ foo ]; then echo "true"; else echo "false"; fi
Notice the difference; the $ symbol has been omitted from preceding the variable name in the conditional. It doesn't matter what word you insert between the brackets. BaSH will always see this statement as true, even if you use a word that has never been associated with a variable in the same shell before.
if [ sooperduper ]; then echo "true"; else echo "false"; fi
Likewise, defining it as an undeclared variable ensures it will always return false:
if [ $sooperduper ]; then echo "true"; else echo "false"; fi
As to BaSH it's the same as writing:
sooperduper="";if [ $sooperduper ]; then echo "true"; else echo "false"; fi
One more tip....
Brackets vs No Brackets
Making matters more confusing, these variations on the IF/THEN conditional both work, but return opposite results.
These return false:
if [ $foo ]; then echo "true"; else echo "false"; fi
if [ ! foo ]; then echo "true"; else echo "false"; fi
However, these will return a result of true:
if $foo; then echo "true"; else echo "false"; fi
if [ foo ]; then echo "true"; else echo "false"; fi
if [ ! $foo ]; then echo "true"; else echo "false"; fi
And, of course this returns a syntax error (along with a result of 'false'):
if foo; then echo "true"; else echo "false"; fi
Confused yet? It can be quite challenging to keep it straight in your head in the beginning, especially if you're used to other, higher level programming languages.