$ dos2unix test.sh
dos2unix: converting file test.sh to UNIX format ...
$ sh test.sh
在cygwin 下运行shell脚本,出现“$'\r': command not found”,这是win dos与Unix文本编辑方式不同造成的。可以使用cygwin工具dos2unix将script改为unix格式。
参见:http://lxs647.iteye.com/blog/2084375
在cygwin 下运行shell脚本,出现“$'\r': command not found”,这是win dos与Unix文本编辑方式不同造成的。可以使用cygwin工具dos2unix将script改为unix格式。
$ dos2unix test.sh
dos2unix: converting file test.sh to UNIX format ...
$ sh test.sh
参见:http://lxs647.iteye.com/blog/2084375