Syntax error: word unexpected (expecting ")") code example
Example: syntax error: word unexpected (expecting "in")
I was on a virtual machine and I started the editor with windows notepad and it converted the script to dos. So, I ended up installing dos2unix, which I used to convert the script. Then, the script worked.