当我们把文件从windows系统中编辑的文件拷贝到linux系统中,如果我们执行文件会保存如下的错:

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

1.在命令模式中使用set ff命令查看文件格式

:set ff

可以看到文件的格式为dos:

fileformat=dos

2.通过命令行修改文件格式

:set ff=unix

执行完命令后再次通过set ff命令查看文件格式,可以看到文件的格式为unix:

fileformat=unix

shell脚本报错:-bash: xxx: /bin/bash^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脚本报错:.sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录

    .sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录 这是因为shell脚本是Windows下编辑的 格式不一样 执行 sed -i 's/\r$//' 脚本名称.sh

  3. 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. ...

  4. -bash: xxx: /bin/sh^M: bad interpreter: No such file or directory

    原因是shell脚本文件的文件格式错误 通过vi编辑器来查看文件的format格式.步骤如下: 1.首先用vi命令打开文件 vi stop.sh 2.在vi命令模式中使用 :set ff 命令 可以看 ...

  5. [shell编程] sh脚本异常:/bin/sh^M:bad interpreter: No such file or directory

    转载地址:http://www.cnblogs.com/pipelone/archive/2009/04/17/1437879.html 在Linux中执行.sh脚本,异常/bin/sh^M: bad ...

  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. shell脚本报错:"[: =: unary operator expected"

    shell脚本报错:"[: =: unary operator expected" 在匹配字符串相等时,我用了类似这样的语句: if [ $STATUS == "OK&q ...

  8. -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 ...

  9. nagios监控客户端报错/usr/bin/perl^M: bad interpreter: No such file or directory

    nagios服务端监控客户端内存时发现监控不上 在客户端直接执行脚本,报错如下: # /usr/local/nagios/libexec/check_memory.pl -w 6% -c 3% -ba ...

随机推荐

  1. uvalive 7299 Boggle

    Boggle is a game in which 16 dice with letters on each side are placed into a 4 × 4 grid. Players th ...

  2. ios7 导航栏适配

    ios ui开发过程中,经常会使用到导航栏,默认的样式比较单一,所以经常需要修改导航栏的样式 ios4: - (void)drawRect:(CGRect)rect { UIImage *image ...

  3. md5,原理待续

    以前项目中copy出来的 import java.security.MessageDigest; public class MD5Util { /** * @todo MD5加码 生成32位md5码 ...

  4. hibernate与ssm多数据源配置

    hibernate: 1.配置多个数据源,比如2个:hibernate.cfg1.xml~hibernate.cfg8.xml <?xml version='1.0' encoding='UTF ...

  5. 32-python代码打包成exe文件-pyinstaller

    安装 pyinstaller: pip install pyinstall 简单使用 最简单的使用方式是运行 pyinstaller myscript.py 来生成可执行文件,其中 myscript. ...

  6. Qt5 How to translate App UI languages

    Adding new language file name in app.pro file. TRANSLATIONS += lg_ch.ts \ lg_en.ts \ lg_new.ts Runni ...

  7. 解决virtualbox共享文件夹没有访问权限的问题

    Virtualbox是一款免费试用的虚拟机软件.基本功能完全可替代需要购买或crack的VMware. 在Windows主机上用Virtualbox搭建Linux虚拟机,虚拟机和主机之间传递文件最方便 ...

  8. JavaScript 分号使用总结

    没有应该不应该,只有你自己喜欢不喜欢.JavaScript 语法长得 C-like 不代表它本质上和 C 是一类语言,所有直觉性的 "当然应该加分号" 都是保守的.未经深入思考的草 ...

  9. jQuery中mouseover和mouseout冒泡产生闪烁问题

    问题:在jQuery中,对元素绑定mouseover和mouseout事件时,每次移入移出该元素和子元素时,都会触发事件,从而会出现闪动的现象. 原因:浏览器的冒泡行为. 解决方案: 使用mousee ...

  10. java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)

    这个问题是说明你的JDBC数据库连接位置出错了,请仔细检查 private static String url; private static String username; private sta ...