I still use this hack without thinking about it in case the variable on the left is empty. But I suppose I should actually be quoting.
[ $X == "hello" ]
When X is empty, it gives: example.sh: line 5: [: ==: unary operator expected
So I fix it (apparently wrongly) with: [ x$X == x"hello" ]
I'll make a point of doing this instead: [ "$X" == "hello" ]