When using = , == and != In [[ right line may contain globes ( * , ? , Etc.).
Backslashes are not needed in your example, although they do not hurt. They are necessary if the line on the right contains a possible wildcard character. For instance:
$ set -x $ [[ hi == 'hi*' ]]; echo $? + [[ hi == \h\i\* ]] + echo 1 1 $ [[ hi == hi* ]]; echo $? + [[ hi == hi* ]] + echo 0 0
source share