Linux提示Syntax error: end of file unexpected (expecting "then") 提示错误

shell命令在windows下编辑过后出现Syntax error: end of file unexpected (expecting "then") 提示错误

 

  

这是因为我在windows下些的脚本,windows和linux的回车换行时不一样的字符,所以脚本在解释时会出现问题。

在windows里,换行用的两个符号,回车换\r行符号\n,在linux下只需一个符号\n就可以了. 

 

sed -i 's/\r$//' autoconf.sh

 

通过命令把换行符转换一下就可以了.

posted @ 2021-01-05 09:35  流逝的轻风  阅读(4064)  评论(0编辑  收藏  举报