shell脚本在cygwin下运行报错: $'\r': command not found

来源:互联网 发布:linux nas 解决方案 编辑:程序博客网 时间:2024/06/04 18:49

在cygwin 下运行shell脚本,出现“$'\r': command not found”,这是win dos与Unix文本编辑方式不同造成的。可以使用cygwin工具dos2unix将script改为unix格式。

$ dos2unix test.shdos2unix: converting file test.sh to UNIX format ...$ sh test.sh

如此便可解决。

参见:http://lxs647.iteye.com/blog/2084375

0 0