shell脚本执行报错:run1.sh: line 10: syntax error: unexpected end of file

syntax error: unexpected end of file

之前也有遇到过,一般是在windows中编写的脚本,复制到linux环境,会出现这个报错,但是:

:set ff        在vi编辑器中,查看文件的格式

:set fileformat=unix    在vi编辑器中将系统文件格式改为unix

查看编辑的文件,是 unix 格式的

最后查看,是 一数if...fifor..do...done的数目是不是一致的,少了一个 done

原文地址:https://www.cnblogs.com/xiaofeng91/p/15070047.html