原文:shell脚本报错:-bash: xxx: /bin/bash^M: bad interpreter: No such file or directory

今天写了一个shell脚本,然后在执行的时候报错,脚本内容很简单,仅供测试: Shell代码 bin sh echo testshell 具体报错信息如下: Shell代码 root localhosttest . test.sh bash:. test.sh: bin bash M:badinterpreter:Nosuchfileordirectory 主要原因是test.sh是我在windo ...

2017-02-22 16:09 0 27091 推荐指数:

查看详情

执行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
-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
解决“/bin/bash^M: bad interpreter: No such file or directory

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

Wed May 15 00:24:00 CST 2019 0 2945
解决“/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
执行shell脚本提示“-bash: ./checkP.sh: /bin/sh^M: bad interpreter: No such file or directory”解决方法

在windows机器下新建了一个shell脚本如下 在Linux上的很多操作一般都是用脚本来实现了,特别是线上的服务器,不用脚本是,直接在上面敲是很危险的,一不小心,手一抖, 那就完了。但是,很多朋友自己的笔记本用的都是windows系统,这真把Ubuntu做为自己笔记本系统的人 ...

Wed Mar 15 01:52:00 CST 2017 0 3753
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM