This seems to be a relatively old question, but I believe the problem is with the header (Shebang). Your script has the following header:
#! /bin/bash However, it should be:
#!/bin/bash That is, without spaces between #! and /bin/bash. This has happened to me before and removing the space solved it. Hope it still helps someone.