/bin/sh^M:bad interpreter:No such file or directory异常
/bin/sh^M: bad interpreter: No such file or directory 异常
问题:
经常遇到一个问题,在windows里面编辑好的文件,比如说sh脚本,传输到linux里面执行不成功,报错如下:
1 | /bin/sh^M: bad interpreter: No such file or directory |
分析
这是不同系统编码格式引起的:在windows系统中编辑的.sh文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息。
解决方案
假设我们的文件是:command.sh
1 | chmod 777 command.sh |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 人生无忌!
评论




