Vi on Linux: show ^M line endings for DOS-format files

Posted by sss on Super User See other posts from Super User or by sss
Published on 2011-11-15T18:37:12Z Indexed on 2012/03/29 5:33 UTC
Read the original article Hit count: 529

Filed under:
|

On Solaris, if you open a file in vi that has Windows line endings, this shows up as ^M at the end of every line.

On Linux, vi is cleverer and understands the Windows file format, and does not display ^M.

Is there a setting to make Linux vi behave the same as Solaris in this respect?

A common problem for us is copying a shell script off a (Windows) dev box and forgetting to dos2unix it, and then being confused when it doesn't work properly. On Solaris the problem is obvious as soon as you vi the file, but not on Linux.

Thanks.

© Super User or respective owner

Related posts about linux

Related posts about vi