set ff = unix convert \ r \ n to \ n linux shell execution report bad interpreter: No such file or directory error

Excerpt: https: //blog.csdn.net/xuforeverlove/article/details/85334726
I. Description of the problem

      1) on windows compiled project, copied to linux and start command, reported the following error:

 

Second, the cause

     1) .sh scripts written in the windows system, so there may be invisible characters, from the figure error term, most likely script file is a DOS format, ie each line end of the line to \ r \ n to identify which are the ASCII code 0x0D, 0x0A.

Third, the solution

    1) entering or editing by vim filename vi filename, that is, this is my vim startup_heartbeat.sh

 

    2) then shift +: command mode. By then set fileformat command set ff or view the file format that my following chart: I can see from this file format is dos.

 

 

  

   3) modify the file format dos to unix. Command set ff = unix or set fileformat = unix modify, and then perform the set ff or set fileformat, to see if the amendment is successful. That is shown below:

 

 

 

  4) Start command, found normal start, so far completed.

 

Guess you like

Origin www.cnblogs.com/LiuYanYGZ/p/12465252.html