I'm just getting used to shell scripting, and I've come across something which I'm not really sure how to google.
In the tutorials I was reading, it suggests that the correct way to write an if statement is like this:
if [ $a == $b ]; then
echo "a == b"
fi
However I've seen in our code base places where the semi colon is omitted:
if [ $a == $b ] then
echo "a == b"
fi
I've also seen double square brackets:
if [[ $a == $b ]]; then
echo "a == b"
fi
When I've tested all of these in bash, there doesn't seem to be a difference. Is there a difference? Does it have to do with compatibility? What is the correct style to adopt?