$'\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   来解决。

猜你喜欢

转载自www.cnblogs.com/yinguojin/p/10901216.html