-bash: ./xxx.sh: /bin/bash^M: bad interpreter: No such file or directory

问题的原因是在windows下编辑然后上传到linux系统里执行的。.sh文件的格式为dos格式。而linux只能执行格式为unix格式的脚本。

不要使用记事本编辑,使用代码编辑器可以正常执行

原文地址:https://www.cnblogs.com/lixihuan/p/9262725.html