Special Characters [^M] appearing at the end of line in file if seen on unix but not when seen in eclipse

后端 未结 5 1963
梦毁少年i
梦毁少年i 2020-12-21 23:53

As described in questions, if I see a file in unix then I see special characters in it like ^M at the end of every line but if I see same file in eclipse than I

5条回答
  •  悲哀的现实
    2020-12-22 00:31

    They are probably Windows carriage return characters. In Windows, lines are terminated with a carriage-return character followed by an end-of-line character. On Unix, only end-of-line characters are normally used, therefore many programs display the carriage return as a ^M.

    You can get rid of them by running dos2unix on the files. You should also change your Eclipse preferences to save files with Unix end of lines.

提交回复
热议问题