Bash – /bin/bash^M: bad interpreter: No such file or directory

Run following command in terminal

sed -i -e 's/\r$//' scriptname.sh

Then try

./scriptname.sh