if [ $a == $b ]; then
echo "a == b"
fi
You can use a semicolon, or you can write then on a separate line. Either one is allowed.
if [ $a == $b ]
then
echo "a == b"
fi
Having neither a ; nor a newline is a syntax error.
$ if [ $a == $b ] then
> echo "a == b"
> fi
bash: syntax error near unexpected token `fi'
As for [ vs [[, see:
- What’s the difference between [ and [[ in Bash?