We all know how annoying those ^M-s can be all over your script or file. ^M is a carriage return, and is commonly seen when files are copied from Windows. All of them can be removed in one step, with vi editor. Open your file in vi and hit escape. Then do like shown below.