linux脚本相关: Syntax error: end of file unexpected (expecting “then“) 或者Syntax error: end of file unexp

linux脚本相关: Syntax error: end of file unexpected (expecting "then") 或者Syntax error: end of file unexpected (expecting "do") 提示错误

如题情况

1、造成该情况的原因:

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

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

2、解决办法:

在vim下,文件结尾 输入

:set fileformat=unix修改ubuntu 和linux服务器、 dos等非图形界面冲突

:wq保存

你可能感兴趣的:(shell)