This is an error you'd get if you were executing the script with a POSIX shell like dash. dash is the default /bin/sh on some platforms such as Ubuntu and Debian.
== is specific to bash ( Bashism ) and is not compatible with POSIX shells like dash, which uses only = to test string equality.
In the context of single brackets, == and = are treated as the same operator in bash, so either can be used.