shell脚本报错:syntax error: unexpected end of file

解决办法1:

vi test.sh
:set fileformat=unix
:wq

解决办法2:

yum install dos2unix
dos2unix my.sh

 

原因剖析:

DOS下文件和Linux下文件格式差异问题导致的。【在windows里,换行用的两个符号,回车\r,换行符号\n,在linux下只需一个符号\n就可以了.】

posted @ 2019-04-28 11:34  Mr.peter  阅读(208)  评论(0)    收藏  举报