The handling of newlines by different operating systems in shell

I use notpad++ to write a linux shell script on a windows system. When it is sent to linux for execution, it keeps reporting an error saying "syntax error: unexpected end of file"
Reason: The text file under Windows DOS uses \r\n as a line break mark, which is 0D 0A in hexadecimal. The text file under Unix uses \n as a line break mark, which is represented as 0A in hexadecimal. So when the script written on windows is uploaded and executed on linux, you need to vim your file, then enter the colon input mode, enter set fileformat=unix, :wq to save
 
In addition, as long as the written files are transmitted in different systems, similar problems need to be paid attention to
In addition, it is best to edit on the ue editor, and pay attention to the unix file format when saving

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326995938&siteId=291194637
Recommended