解决方法:写完代码后不要直接“回车”,在每行尾部加“空格”再“回车”,保存文本。如果觉得空格碍眼,可以在保存运行后再删除空格。
同类其他的常见问题(如^M或win下编辑lin下不能用),网上搜索一大把,就不列举了。
参考:
http://www.ouvps.com/?p=635
Shell编程错误 – syntax error near unexpected token `then'
原文:https://www.cnblogs.com/wutou/p/14639495.html