原因是shell脚本文件的文件格式错误

通过vi编辑器来查看文件的format格式。步骤如下:

1.首先用vi命令打开文件

vi stop.sh

2.在vi命令模式中使用 :set ff 命令

可以看到改文件的格式为

fileformat=dos

3.修改文件format为unix

在vi命令模式中使用命令:set ff=unix

执行完后再通过set ff命令查看文件格式,结果如下:

fileformat=unix

-bash: xxx: /bin/sh^M: bad interpreter: No such file or directory的更多相关文章

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

    今天执行一个shell脚本,然后在执行的时候报错,脚本内容很简单,仅供测试: #!/bin/sh echo "test shell " 具体报错信息如下 [root@localho ...

  2. shell脚本报错:-bash: xxx: /bin/sh^M: bad interpreter: No such file or directory --引用自http://blog.csdn.net/xiaaiwu/article/details/49126777

    windows下编辑然后上传到linux系统里执行的..sh文件的格式为dos格式.而linux只能执行格式为unix格式的脚本. 我们可以通过vi编辑器来查看文件的format格式.步骤如下: 1. ...

  3. -bash: ./start.sh: /bin/sh^M: bad interpreter: No such file or directory 错误解决方案

    问题描述:sh文件中,在win环境下,用WinSCP编辑,出现如下错误: -bash: ./start.sh: /bin/sh^M: bad interpreter: No such file or ...

  4. bin/sh^M: bad interpreter: No such file or directory解决

    问题:bin/sh^M: bad interpreter: No such file or directory 原因:.sh脚本在windows系统下用记事本文件编写的.不同系统的编码格式引起的. 解 ...

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

    bash脚本:/bin/sh^M:bad interpreter: No such file or directory   dos2unix 实际上就是把文本文件中面的^M删除 用SHELL 写了一个 ...

  6. Linux - /bin/sh^M: bad interpreter: No such file or directory

    问题 在Windows环境下用Notepad++写了个shell脚本,上传到Linux平台后运行报错如下: /bin/sh^M: bad interpreter: No such file or di ...

  7. sh脚本异常:/bin/sh^M:bad interpreter: No such file or directory

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  8. Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。

    在Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  9. linux sh脚本异常:/bin/sh^M:bad interpreter: No such file or directory

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory.这是不同系统编码格式引起的:在windows系统中编辑的. ...

随机推荐

  1. 8086汇编之 CALL 和 RET指令

    Ret 和 call 也是转移指令,可是他们跟jmp不同的是,这两个转移指令都跟栈有关系. <1> ret 用栈中的数据改动IP的地址,从而实现近转移 ( ip ) = ( (ss)*16 ...

  2. OGNL表达式的基本语法和用法

    首先我们一起来看一下OGNL中的#.%和$符号. 关于OGNL各种用法总结参看:http://blog.163.com/seara520@126/blog/static/720693042010320 ...

  3. python 使用urllib.urlopen超时问题的解决方法

    准备写一个python脚本抓取网页数据,前面抓了几个都没有什么问题,但总会抓取不完整,在中间过程中没有反应,发现执行urlopen的地方总是提示超时,百度了一下,因为我使用的是urllib不是urll ...

  4. 每日英语:Now on Taobao: Outsourced Care for Grandma

    China's newly revised elder-care law has come as good news for a handful of entrepreneurs who specia ...

  5. Codeforces Round #235 (Div. 2) C. Team

    C. Team time limit per test 1 second memory limit per test 256 megabytes input standard input output ...

  6. 使用ICSharpCode.TextEditor制作一个语法高亮显示的XML编辑器

    使用ICSharpCode.TextEditor制作一个语法高亮显示的XML编辑器 品高工作流 的流程模拟器中使用了一个具有语法高亮和折叠功能的XML编辑器,其核心就是用了SharpDevelop中的 ...

  7. Matlab三维绘图

    三维绘图 1 三维绘图指令 类 别 指 令 说 明 网状图 mesh, ezmesh 绘制立体网状图 meshc, ezmeshc 绘制带有等高线的网状图 meshz 绘制带有“围裙”的网状图 曲面图 ...

  8. SpringMVC之学习(1)

    先来一个springmvc的基本配置,照样输出hello world 1.先导入springmvc所需要的开发包 最起码需要这么多的基本包,然后开始上配置 2.先在web.xml里进行引入,和Stru ...

  9. Memcache内存分配策略

    一.Memcache内存分配机制 关于这个机制网上有很多解释的,我个人的总结如下. Page为内存分配的最小单位. Memcached的内存分配以page为单位,默认情况下一个page是1M,可以通过 ...

  10. Statement和PreparedStatement都是用来发送和执行SQL语句的

    Statement和PreparedStatement都是用来发送和执行SQL语句的 DriverManager管理一组驱动程序