Running shell commands in .sh file results to error

listed in answer

Running shell commands in .sh file results to error
0 votes, 0.00 avg. rating (0% score)

ANSWER:

You have carriage returns and possibly other extraneous characters in your script file; use dos2unix to remove them.

by geekosaur from http://unix.stackexchange.com/questions/37094