bin/bash^M: bad interpreter: No such file or directory解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pengtgimust/article/details/81948605

问题:bin/bash^M: bad interpreter: No such file or directory

原因:.sh脚本在windows系统下用记事本文件编写的。不同系统的编码格式引起的。

解决方法:修改.sh文件格式

(1)使用vi工具
vi build_android.sh

(2)利用如下命令查看文件格式
:set ff 或 :set fileformat
可以看到如下信息
fileformat=dos 或 fileformat=unix

(3) 利用如下命令修改文件格式
:set ff=unix 或 :set fileformat=unix
:wq (存盘退出)

注:在windows下通过git bash可以直接编写unix格式.sh!

猜你喜欢

转载自blog.csdn.net/pengtgimust/article/details/81948605
今日推荐