网站首页 文章专栏 syntax error near unexpected token `$’do\r”
在windows下通过记事本编辑shell脚本,上传到linux环境下执行。
提示syntax error:unexpected end of file 或者syntax error near unexpected token `$’do\r”错误
原因:Linux和windows下的回车换行符不兼容的问题
解决方案:
使用下面的命令将文件格式设置为unix格式即可解决上述错误。
vi 1.sh
:set fileformat=unix
:wq
转载请注明出处