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

  1. $ dos2unix test.sh
  2. dos2unix: converting file test.sh to UNIX format ...
  3. $ sh test.sh

如此便可解决。
参见:http://lxs647.iteye.com/blog/2084375

分类: web

标签:   cygwin