Sep 212012
 

It’s pretty annoying supporting both Windows and Linux systems. One of the things that comes up over and over is line endings. You’re about to run a script, and immediate get an error about the bash command not found or something bizarre like that.

Fortunately, there are easy ways to fix this.
(note, in the following, to type the ^M character, you’ll actually be typing ^V^M)

Solution 1: use sed

sed s/^M//

Solution 2: use the same replacement string in vim

:%s/^M//g

Solution 3 (the really easy way): Use the dos2unix command that comes with most *nix distros:

dos2unix

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.