解决 centos下执行sh文件报错“/bin/bash^M: 坏的解释器:没有那个文件或目录” 问题

今天部署一个springboot项目到centos系统下,自己在Windows写的启动脚本,执行过程中出现/bin/bash^M: 坏的解释器:没有那个文件或目录错误,无法正常运行。 按照以往的经验分析是因为在Windows环境下的换行符在Linux下是无法被识别的,出现一个^M符号。然后vi一下这...

百度搜索:蓝易云【Shell错误:/bin/bash^M: bad interpreter: No such file or directory】

百度搜索:蓝易云【Shell错误:/bin/bash^M: bad interpreter: No such file or directory】

这个错误通常是由于在Windows系统下编辑的脚本文件在Linux系统下执行时引起的。在Windows中,文本文件的行结束符是“\r\n”(回车换行),而在Linux中,行结束符是“\n”(换行)。当你将包含Windows风格换行符的脚本文件拷贝到Linux系统上运行时,会导致该错误。...

Shell错误:/bin/bash^M: bad interpreter: No such file or directory

错误原因和现象在执行shell脚本的时候,报错:/bin/bash^M: bad interpreter: No such file or directory。是由于该脚本文件是在Windows平台编写,然后在MacOS平台中执行。在Windows平台上文件是dos格式,换行符尾\r\n,而MacO...

starting container process caused “exec: \“/bin/bash\“: stat /bin/bash: no such file or directory

一、问题内容登录到K8S单个部署的容器中时,登出虚线报错。kubectl -n prod mytest -it test-web /bin/bash完整报错信息[root@lydtest01 ~]$ kubectl -n prod mytest -it test-web /bin/bash kube...

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

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

一、问题 二、原因因为windows下的换行符是\r\n,而linux下是\n,所以多了一个\r,导致shell脚本的第一行#!/bin/sh变成了#!/bin/sh\r会报/bin/sh^M: bad interpreter: No such file or directory错误了三、解决vim...

[帮助文档] Linux实例使用su命令切换用户时,提示“su:failedtoexecute/bin/bash:Permissiondenied”错误怎么办_云服务器 ECS(ECS)

本文介绍在Linux系统的ECS实例中,使用su命令切换用户失败,提示“su: failed to execute /bin/bash: Permission denied”错误时的解决方案。

Shell-/bin/bash和/bin/sh解释器的误用引起的脚本语法错误

Shell-/bin/bash和/bin/sh解释器的误用引起的脚本语法错误

生猛干货从系统安装到程序员必备的Linux技能,还原真实工作场景,手把手带你实战演练背景下面的脚本,在Linux上运行良好,在SUNOS执行的时候报语法错误。#! /bin/sh #支持fwu的使用fwu 不支持的使用fu PS_TYPE="ps -fwu" do_ps=`ps -fwu 2>...

[帮助文档] 执行yum命令提示“-bash:/usr/bin/yum:/usr/bin/python:badinterpreter:Nosuchfileordirectory”错误怎么办_云服务器 ECS(ECS)

本文介绍在CentOS 7系统的ECS实例中,执行yum命令提示“-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory”错误的解决方案。

#!/bin/sh与#!/bin/bash有区别

如以下脚本:function test(){}前者报错。

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

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

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

社区圈子

开发与运维
开发与运维
集结各类场景实战经验,助你开发运维畅行无忧
6411+人已加入
加入