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

问题: 我在写了shell文件,创建shell文件sky g.文件。后使用chmod xsky g.sh给予可执行的权限后再次执行 chmod xtoutiao app.sh 执行shell文件 . toutiao app.sh 出现下面的报错: bin bash M: bad interpreter: No such file or directory 错误介绍 通过上面我们可以看到有个 M个标 ...

2020-09-10 22:55 0 650 推荐指数:

查看详情

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

在执行shell脚本时提示这样的错误主要是由于shell脚本文件是dos格式,即每一行结尾以\r\n来标识,而unix格式的文件行尾则以\n来标识。 查看脚本文件是dos格式还是unix格式的几种办法。(1)cat -A filename 从显示结果可以判断,dos格式的文件行尾为^M ...

Mon Apr 04 00:55:00 CST 2016 0 12043
-bash: ./xxx.sh: /bin/bash^M: bad interpreter: No such file or directory

一些人喜欢用vim来写linux shell script, 但是, 有的人喜欢在Windows下用一些方便的编辑器(比如鼎鼎大名的Notepad++)写好, 然后拷贝文件到linux下, 结果呢, 在执行脚本a.sh的时候, 会出现如下问题: 什么原因呢, 我们有理由怀疑是文件 ...

Fri May 24 03:43:00 CST 2019 0 505
执行shell脚本报错-bash: ./startup.sh: /bin/sh^M: bad interpreter: No such file or directory

搭建nacos集群时,配置完毕后执行脚本报错,通过查询资料发现^M表示 Windows环境下dos格式文件传输到unix系统时,会在每行的结尾多一个^M,所以在执行的时候出现了这种现象,但是你在unix或者Linux环境下使用vi编辑的时候,会在下面显示此文件的格式,比如”sky8g.sh ...

Mon Apr 20 22:27:00 CST 2020 0 742
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM