$'\r': command not found 或者 syntax error: unexpected end of file 或者 syntax error near unexpected token `$'\r''

执行shell脚本如果报如下错误:

syntax error near unexpected token `$'\r''

syntax error: unexpected end of file

$'\r': command not found

可能原因是写代码是编辑环境是window,或者Linux下的非Linux编码,

可以执行:dos2unix filename   来解决。

posted @ 2019-05-21 17:33  谁的小流浪  阅读(343)  评论(0编辑  收藏  举报