经常会遇到这种情况,在windows下写的脚本,代码会在linux下无法执行,错误就是: bad interpreter: No such file or directory

1.原因
这通常都是由于windows下对文本文件的保存格式与unix下不同造成的,windows下回车的字符是'\r\n',而linux下是'\n'
2,解决方法
vim file
在命令模式下,输入 :set ff?
查看文件格式为dos或者unix
:set ff=unix
:wq
保存退出,即可。

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

  1. JDK1.3安装出现/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory Done.

    今天是出道以来第一次安装JDK1.3,大学的时候接触的也已是JDK1.4,而且是在Red Hat Enterprise Linux Server release 6.6上,安装JDK1.3是由于软件组 ...

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

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

  3. 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: bad interpreter: No such file or directory

    执行shell脚本    错误提示如下:    bash: ./back : bad interpreter:No such file or directory 因为操作系统是windows,在win ...

  5. 执行Python "/bin/usr/python: bad interpreter: No such file or directory" 错误

    今天在电脑上写了一个Python脚本,写好之后用ftp传上去,然后执行/var/www/cron.py,结果报错,/bin/usr/python: bad interpreter: No such f ...

  6. centos 7安装mysql报错-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory

    [root@localhost mysql]# ./scripts/mysql_install_db  --user=mysql -bash: ./scripts/mysql_install_db: ...

  7. sh脚本异常:bad interpreter: No such file or directory

    转:http://bluedest.iteye.com/blog/1674963 在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file o ...

  8. 执行脚本出现bin/bash: bad interpreter: No such file or directory

    -bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory VI打开文件,没发现任何问题, 把/bin/bash ...

  9. shell 脚本执行,出现错误bad interpreter: No such file or directory

    出现bad interpreter:No such file or directory的原因是文件格式的问题.这个文件是在Windows下编写的.换行的方式与Unix不一样,但是在VI下面如果不Set ...

  10. 转载:执行脚本出现bin/bash: bad interpreter: No such file or directory

    转载网址:http://blog.csdn.net/red10057/article/details/8051650 刚刚学习 SHELL 写了一个简单的例子 发生如下错误 -bash: ./test ...

随机推荐

  1. ios浅谈关于nil和 NIL区别及相关问题(转)

    转自:http://blog.csdn.net/guozh/article/details/8469131 个就是将引用技术减1,所谓的引用计数就是看看有多个指针指向一块内存实体,当release一次 ...

  2. Socket与TcpClient的区别(转载)

    Socket和TcpClient有什么区别 原文:http://wxwinter.spaces.live.com/blog/cns!C36588978AFC344A!322.entry 回答: &qu ...

  3. myeclipse添加svn

    一直在用MyEclipse,每次重装或者换开发环境时都需要安装svn插件,每次都是在网上找,感觉没有说的太明白的,还是自己写个以备将来查看. 安装svn插件有很多种方式,在线的.离线的.解压的(又分为 ...

  4. 数据泵导出/导入Expdp/impdp

    一下转自 http://blog.csdn.net/jionjionyoushen/article/details/6789686 数据泵导出/导入Expdp/impdp Oracle 10g引入了D ...

  5. js中的for-of循环遍历数组

    遍历数组要怎么做,可能你首先想到的会是for循环,当然for循环在JavaScript 刚萌生的时候就出现了,想到它也是理所当然的 var a=[[1,2],[3,4],5] for(var i=0; ...

  6. Mysql学习(慕课学习笔记6)修改数据表(上)

    添加单列 Alter table tb1_name ADD[column] col_name column_definition [first | after col_name] 列名称       ...

  7. apache用户认证、默认主机、301跳转

    我更正论坛一个同学帖子(今天坑我一下午):原文http://www.apelearn.com/bbs/foru ... 3%BB%A7%C8%CF%D6%A4 apache用户认证.默认主机.301跳 ...

  8. NAS4Free 安装配置(五)配置SMB

    配置SMB 现在我们有2块存储设备,一块做下载盘,一块做数据盘 为了便于管理和扩展,我们分别在两块盘上建文件夹和Dataset 对于download盘,因为是UFS,所以只能建文件夹 我们把整个盘共享 ...

  9. CC2530 PWM波形产生。

    1.使用TIM3_CC1,相关联引脚P1_7 #define GPIOPWM() do{P1SEL |= 0x80;}while(0);#define GPIOCLOSEPWM() do{P1SEL  ...

  10. 使用ARM和VMSS创建自动扩展的web集群

    在很多的商业场景中,用户的访问,峰值时间都是很难预测的,尤其是做一些市场推广活动和促销的时候,到底部署什么规模的web集群合适,这一直是个问题,部署过量会造成高成本和资源不必要的浪费,部署过少,如果到 ...