If you use a windows editor and upload code to a Linux server to run from the command line, then you have probably run into the dreaded ^M issue. This happens when uploading files from a windows system, using ascii mode. Some Windows editors may add the character to the end of each line as well during editing.

This can be very annoying but here is a simple way to fix it:

Install the dos2unix utility
yum install dos2linux

run dos2linux [filename]