执行shell脚本    错误提示如下:
    bash: ./back : bad interpreter:No such file or directory

因为操作系统是windows,在windows下编辑的脚本,所以有可能有不可见字符。

从你的脚本及报告的错误看来, 很有可能是你的脚本文件是DOS格式的, 即每一行的行尾以\r\n来标识, 其ASCII码分别是0x0D, 0x0A.
可以有很多种办法看这个文件是DOS格式的还是UNIX格式的, 还是MAC格式的

vi filename
然后用命令
:set ff?
可以看到dos或unix的字样. 如果的确是dos格式的, 那么你可以用set ff=unix把它强制为unix格式的, 然后存盘退出.

shell: bad interpreter: No such file or directory的更多相关文章

  1. 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'     ;;      ...

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

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

  3. shell 报错 /bin/bash^M: bad interpreter: No such file or directory

    shell 执行报错: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory 原因:window和linux 的文件格式 ...

  4. 执行shell脚本时提示bad interpreter:No such file or directory的解决办法

    执行shell脚本时提示bad interpreter:No such file or directory的解决办法 故障现象:在终端直接cd /var正常,在shell脚本中执行则报错.原因是脚本是 ...

  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. python/shell脚本报异常^M: bad interpreter: No such file or directory

    问题:在Windows写了一python脚本,上传Linux服务器执行,报异常*****^M: bad interpreter: No such file or directory 原因:window ...

  7. Linux学习笔记之Linux shell脚本运行出现问题:bash: ./test: bin/sh: bad interpreter: No such file or directory

    问题: 在Linux系统中使用“vi test.sh”命令创建.sh文件,保存文件(:wq)并赋予权限(chmod +x test.sh)后,执行(./test.sh),出现问题:“bash: ./t ...

  8. linux执行shell脚本时提示bad interpreter:No such file or directory的解决办法

    故障现象:在终端直接cd /var正常,在shell脚本中执行则报错.原因是脚本是在windows平台下写的,换行符与Linux不同,造成脚本不能正确执行 出现bad interpreter:No s ...

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

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

随机推荐

  1. [NOIP2012]国王游戏 题解

    题目大意: n个人排成一排,排头固定,其他可以变.每一个人左右手都有一个整数,一个人的分数为他所有前面的人左手上的数的乘积除以他右手上的数(向下取整),求在整列中最大分数的最小值. 思路: 首先,一切 ...

  2. db2look和db2move详解

    db2look和db2move简单实例 --- 建库create database db_name on filesystem_location using codeset utf-8 territo ...

  3. C#对图片的操作

    1.根据图片路径返回字节 public static byte[] getImageByte(string imagePath) { FileStream files = new FileStream ...

  4. easy ui插件

    简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...

  5. linux中test与[ ]指令的作用

    linux中test与[ ]指令的作用: 在Linux中,test和[ ]功能是一样的,类似于c语言中的( ).不过Linux的test和[ ]是指令.在和if或者while联用时要用空格分开.

  6. 二、jquery选择器

    在jquery库中,可以通过选择器实现DOM元素快捷选择这一重要的核心功能. 1.选择器的优势 (1)代码更简单 由于在jquery库中,封装了大量可以通过选择器直接调用的方法或函数,使编写代码更加简 ...

  7. php 跨服务器ftp移动文件

    $ftp_server = "120.25.1.1";$ftp_user_name = "p1111";$ftp_user_pass = "psa12 ...

  8. hibernate学习(6)——加载策略(优化)

    1. 检索方式 1  立即检索:立即查询,在执行查询语句时,立即查询所有的数据. 2 延迟检索:延迟查询,在执行查询语句之后,在需要时在查询.(懒加载) 2.  检查策略 1  类级别检索:当前的类的 ...

  9. cache-coherent nonuniform memory access

    COMPUTER OR GANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

  10. log4j使用快速入门【转】

    1.引言 在应用程序中添加日志记录总的来说基于三个目的: .监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工作 .跟踪代码运行时轨迹,作为日后审计的依据 .担当集成开发环境中的调 ...