This happens when executing scripts with a different line endings pattern different to that of the system you are running. Since it seems you are running on a linux system, open your script in an editor like geany then convert line endings to unix style.
This is also encountered with apache.
Regards.