ubuntu 执行脚本报错 ”bad interpreter: No such file or directory“

  • 分类: Linux
  • 发表日期:2022-03-10 18:35:00
  • 最后修改:2022-03-10 18:35:00

问题

执行bash脚本时出错:

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

原因

我是在windows系统下远程编辑linux系统的脚本,所以保存时的文件格式是dos格式,而linux系统要求脚本格式为unix。

方法

在linux系统打开脚本,shift + : 然后输入如下的命令

set ff=unix

保存退出,再次执行脚本。

 

post
2021年8月17日 12:07 原创
post
2021年9月3日 15:30
post
2022年1月3日 10:05 原创
post
2022年2月24日 15:01 原创
post
2022年7月7日 10:50

0 评论

大哥整点话呗~