原因:.sh脚本在windows系统下用记事本文件编写的。不同系统的编码格式引起的。
解决方法:修改.sh文件格式
(1)使用 vim 编辑
vi test.sh
(2)利用如下命令查看文件格式
:set ff 或 :set fileformat
可以看到如下信息
fileformat=dos 或 fileformat=unix
(3) 利用如下命令修改文件格式
如果是 ff=dos
:set ff=unix 或 :set fileformat=unix
:wq (存盘退出)
转载请注明:微刻 blog.wecot.cn » 解决:bin/sh^M: bad interpreter: No such file or directory 问题