shell 执行报错:

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

原因:window和linux 的文件格式不同,这个问题是:linux换行只需要 /n windows的换行是 /r/n

导致文件不能识别。

vim 查看文件格式:  

set ff?

fileformat=dos

就是window 的文件格式

修改:

set fileformat=unix

搞定

shell 报错 /bin/bash^M: bad interpreter: No such file or directory的更多相关文章

  1. windows系统编辑过的脚本文件,在linxu上执行报错 /bin/sh^M: bad interpreter: No such file or directory

    如题! 现象: 当时的场景是这样的:我在IDEA中编辑了项目中的脚本sh,然后利用maven打成zip包.把zip包上传到linux服务器解压运行. 当在linux服务器上运行该sh脚本文件时,提示错 ...

  2. ipvsadm服务报错/bin/bash: /etc/sysconfig/ipvsadm: No such file or directory

    问题: 在执行重启ipvsadm服务时报错: 提示没有找到/etc/sysconfig/ipvsadm 解决: [root@lvs1 ~]# ipvsadm --save > /etc/sysc ...

  3. Shell脚本报错:-bash: ./switch.sh: /bin/bash^M: bad interpreter: No such file or directory

    在学习shell中测试case参数命令代码如下 #!/bin/bash #switch测试 case $1 in     start)         echo 'start'     ;;      ...

  4. Linux shell 脚本报错:/bin/bash^M: bad interpreter: No such file or directory

    今天遇到一个很诡异的问题,一直运行很正常的shell脚本失败了,只是昨天增加了一个参数而已. 报错信息: /bin/bash^M: bad interpreter: No such file or d ...

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

    当我们把文件从windows系统中编辑的文件拷贝到linux系统中,如果我们执行文件会保存如下的错: shell脚本报错:-bash: xxx: /bin/bash^M: bad interprete ...

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

    刚刚学习SHELL 写了一个简单的例子发生如下错误 -bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory ...

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

    在windows下编写shell脚本在linux下运行会出报错: [hadoop@master data]$ ./load_ods_table.sh -bash: ./load_ods_table.s ...

  8. /bin/bash^M: bad interpreter: No such file or directory 解决办法

    参考:-bash: ./my_script: /bin/bash^M: bad interpreter: No such file or directory [duplicate] 有的时候运行.sh ...

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

    <今天遇到的问题,  网上有非常多类似的文章,  个人记录下来,  加深记忆,  已经明确的就绕路吧.> 运行一个脚本full_build.sh 时, 一直是提示我: -bash: ./f ...

随机推荐

  1. CentOS 查看进程状态

    Linux中ps与top命令   ============================================================================ 这两个命令都 ...

  2. TOJ1698/POJ3264Balanced Lineup (线段树 or RMQ-ST)

    传送门:http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1698 时间限制(普通/Java): ...

  3. 11. Container With Most Water(头尾双指针)

    Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). ...

  4. SQLite4Unity3d

    What's this? When I started with Unity3d development I needed to use SQLite in my project and it was ...

  5. makefile文件操作大全

     Makefile的规则 -- 转自 :http://blog.csdn.net/ruglcc/article/details/7814546/ 在讲述这个Makefile之前,还是让我们先来粗略地看 ...

  6. C++ 单例模式(懒汉、饿汉模式)

    1.简单的单例模式实现 2.C++的构造函数不是线程安全的,所以上述代码在多线程的情况下是不安全的,原因是new Singelton时,这句话不是原子的,比如一个线程执行了new的同时,另一个线程对i ...

  7. bbs项目中对反向查询和分组查询的具体的应用

    我的数据库是按照下面的图片的方式设计的 然后看下model中代码 class User(models.Model): uid = models.AutoField(primary_key=True) ...

  8. [z]libevent入门教程:Echo Server based on libevent 不指定

    [z]https://www.felix021.com/blog/read.php?2068 花了两天的时间在libevent上,想总结下,就以写简单tutorial的方式吧,貌似没有一篇简单的说明, ...

  9. Android.Zygote

    Zygote进程 http://www.kaifazhe.com/android_school/397261.html http://anatomyofandroid.com/2013/10/15/z ...

  10. Codeforces 749C. Voting 模拟题

    C. Voting time limit per test: 1 second memory limit per test: 256 megabytes input: standard input o ...