Is your script running as a bash script or as something else? You can ensure that it is run as a bash script by using this first line
= and == are both valid bash string comparison operators but they must be surrounded by space
BTW, [[ ]] is preffered over [ ] for reasons explained here
It's easier to read your code if you put it in code tags
(that's a link to instructions or you may prefer to use "Advanced Edit" mode which has a # button for code tags).