Double check that you have #!/bin/bash at the top of the file.
xxxxxxxxxx
forgetting the slashs can cause this error.
xxxxxxxxxx
if you cannot run a script called yourScript.sh
run the following command in terminal
sed -i -e 's/\r$//' yourScript.sh
Then your script should run
/bin/bash^M: bad interpreter: No such file or directory
xxxxxxxxxx
Try using linux (LF) instead of windows (CR LF)