bash: ./a.sh: /bin/bash^M: bad interpreter: No such file or directory linux 执行脚本报错

方法一:vim a.sh进入a.sh后, 在底部模式下, 执行:set fileformat=unix后执行:x或者:wq保存修改。 然后就可以执行./a.sh运行脚本了。

方法二:直接执行sed -i “s/\r//” a.sh来转化, 然后就可以执行./a.sh运行脚本了。

方法三:直接执行dos2unix a.sh来转化, 然后就可以执行./a.sh运行脚本了。 若失败可以加上 busyboy

busyboy dos2unix a.sh 来执行

原Po地址:https://blog.csdn.net/stpeace/article/details/45604015

猜你喜欢

转载自blog.csdn.net/qq_42306041/article/details/95328986
今日推荐