Why does this simple if statement result in a syntax error?
#!/bin/bash
if [[ 1 == 1 ]] ; then
# echo "hello"
fi
The error is
line 5: syntax error near unexpected token `fi’
It works as expected if the echo is uncommented.
Edit
Thanks, fixed the error using :. Silly bash. =P
#!/bin/bash
if [[ 1 == 1 ]] ; then
:# echo "hello"
fi
Because, as you can see in man bash, the correct syntax for
ifisAnd if you look up the definition of
list, it saysThis “one or more” is the reason why your example is not a valid syntax.