如题!

现象:

当时的场景是这样的:我在IDEA中编辑了项目中的脚本sh,然后利用maven打成zip包。把zip包上传到linux服务器解压运行。

当在linux服务器上运行该sh脚本文件时,提示错误:/bin/sh^M: bad interpreter: No such file or directory

原因:

windows的换行符与linux的换行符是有区别的。我的IDEA使用了系统自带的换行符号(windows),所以在linux服务器上,该换行符就有问题了。

解决方法:

IDEA的话:

File --> setting --> Editor --> Code Style , 修改属性“Line separator” 为“Unix and OS X(\n)”

如果是Eclipse:

打开菜单 Window - Preferences,左边选择 General - Workspace ,右边的 New text file line delimiter选择 Other ,然后在里面选择 Unix

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

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

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

  2. 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系统中 ...

  3. 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系统中编辑的. ...

  4. [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 ...

  5. 执行shell脚本提示“-bash: ./checkP.sh: /bin/sh^M: bad interpreter: No such file or directory”解决方法

    在windows机器下新建了一个shell脚本如下

  6. 执行shell脚本时提示/bin/sh^M: bad interpreter: No such file or directory

    执行脚本时提示解释器有问题,错误提示如下: 这种提示一般是脚本在windows系统之通过记事本写的,记事本修改过的文本,会默认在文本前面加上一些看不到的标记,导致shell脚本不能被shell解释器识 ...

  7. 运行该脚本出现/bin/sh^M: bad interpreter: No such file or directory

    错误中脚本文件的一个非常可能的原因是DOS格的, 即每一行的行尾以\r\n来标识, 其ASCII码各自是0x0D, 0x0A.  能够有非常多种办法看这个文件是DOS格式的还是UNIX格式的, 还是M ...

  8. window下编写python脚本在linux下运行出错 usr/bin/python^M: bad interpreter: No such file or directory

    今天在windows下使用notepad++写了个python脚本,传到linux服务器执行后提示:-bash: ./logger.py: usr/bin/python^M: bad interpre ...

  9. windows系统下使用bat脚本文件设置 JDK 系统环境变量

    号开头的行不要写在bat文件中 # java_init.bat # 注意文件换行符是windows系统下的(CR LF),文件编码是ANSI # path变量追加这个可以拓展到tomcat,mysql ...

随机推荐

  1. jQuery BlockUI Plugin Demo 6(Options)

    Options BlockUI's default options look (exactly) like this: // override these in your code to change ...

  2. Python(1)自动发送邮件

    python发邮件需要掌握两个模块的用法,smtplib和email,这俩模块是python自带的,只需import即可使用.smtplib模块主要负责发送邮件,email模块主要负责构造邮件. sm ...

  3. 解决移动端1px的问题,设备像素比devicePixelRatio的应用

    本文主要针对移动端1物理像素问题展开 解决这个问题先要了解一下概念: CSS像素(CSS Pixel):(通俗说:样式中写的值)就是我们在样式代码中常写的逻辑像素,是一个抽象概念,实际并不存在 设备独 ...

  4. 关于PADS的一些概念和实用技巧(一)

    关于PADS的一些概念和实用技巧(一) 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 1. 关于part,CAE Decal,PCB Decal Part ...

  5. 记录:larvel Windows 安装

    先安装Composer  不多叙述了 链接: https://pan.baidu.com/s/1sljuImh 密码: qcj3 打开命令窗口 进入你的集成环境 网站根目录下 laravel程序会下载 ...

  6. redis相关操作命令

    一.相关命令列表: 命令原型 时间复杂度 命令描述 返回值 KEYS pattern O(N) 时间复杂度中的N表示数据库中Key的数量.获取所有匹配pattern参数的Keys.需要说明的是,在我们 ...

  7. springboot与shiro在html中使用shiro标签

    上一章讲环境搭建 springboot与shiro和mybatis和mysql 现在讲html中怎么使用shiro标签,这里是基于上一章讲的 在pom文件引入依赖 <dependency> ...

  8. 多年经验【Parallels Desktop14.0.1 永久激活 】版 推荐苹果mac 虚拟机pmg序列号

    parallels desktop 14 mac 激活码          parallels 13免费密钥 parallels desktop 14 激活码 很多用 MAC 的朋友发现平时离不开 W ...

  9. Word 插入目录的 5 种方法

    1. "运用多级编号法"之图文教程 效果图: 步骤: 首先,为了更好的演示,我们先将我们的一级标题全部选中,按住Ctrl键,去一一选择就行了. 选中一级标题后,我们进入「开始」-「 ...

  10. oracle经典查询语句

    1. select * from emp;   2. select empno, ename, job from emp;   3. select empno 编号, ename 姓名, job 工作 ...