I feel like this should be really simple but I can't get past this step.
$num = 5
if [$num > 2]; then echo greater; fi
the problem is, I keep getting [5: command not found
.
Why is it not evaluating the if [ test ]
block correctly? It's like the shell forgot about the if
and just moved on to "hey, [5 > 2
does not look like a command, I can't find [5
"... but [5
isn't a command, it's part of the if
test block?
I have tried using different brackets and using -gt
instead of >
. The problem is bash doesn't actually ever do the test. For some reason it ignores if
.