Tag: dos
dos2unix
by BenV on Aug.21, 2009, under Morons, Software
Another annoying thing: morons that save their files with dos line endings.
Also known as “I’ve got motherfucking ^M in my file, AAAIIEEEEYGGrrgrll“.
I usually find out about this when bash complains about stuff like this:
benv@janeman:~$ ./bla.pl
-bash: ./bla.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
(HAAAAAT!!!)
Solution:
benv@janeman:~$ vim kankerfile
:set fileformat=unix
:wq
(Don’t confuse fileformat with filetype, one is used for encoding, the other for things as syntax highlighting)
Solution 2:
benv@janeman:~$ dos2unix kankerfile
I never use this since I never have that piece of cancer called dos2unix, but some distros do.
Solution 3:
sed -ie 's/\r//g' bla.pl
That should fix it. On to the “let’s trash my home directory with my fancy new perl script that I just converted” 😉