【转】执行脚本出现bin/bash: bad interpreter: No such file or directory
【转自】http://blog.csdn.net/wind19/article/details/4822666
错误原因之一很有可能是你的脚本文件是DOS格式的, 即每一行的行尾以/r/n来标识, 其ASCII码分别是0x0D, 0x0A.
可以有很多种办法看这个文件是DOS格式的还是UNIX格式的, 还是MAC格式的
(1). vi filename
然后用命令
:set ff?
可以看到dos或unix的字样. 如果的确是dos格式的, 那么你可以用set ff=unix把它强制为unix格式的, 然后存盘退出. 再运行一遍看.
(2). 用joe filename
如果是DOS格式的, 那么行尾会有很多绿色的^M字样出现. 你也可以用上述办法把它转为UNIX格式的.
(3). 用od -t x1 filename
如果你看到有0d 0a 这样的字符, 那么它是dos格式的, 如果只有0a而没有0d, 那么它是UNIX格式的, 同样可以用上述方法把它转为UNIX格式的.
【转】执行脚本出现bin/bash: bad interpreter: No such file or directory的更多相关文章
- 执行脚本出现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 ...
- 转载:执行脚本出现bin/bash: bad interpreter: No such file or directory
转载网址:http://blog.csdn.net/red10057/article/details/8051650 刚刚学习 SHELL 写了一个简单的例子 发生如下错误 -bash: ./test ...
- 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 ...
- 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: ...
- -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到p ...
- -bash: /usr/local/mysql/scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
安装 MySQL 初始化时,报错如下: [root@hcdb1 ~]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/m ...
- python/shell脚本报异常^M: bad interpreter: No such file or directory
问题:在Windows写了一python脚本,上传Linux服务器执行,报异常*****^M: bad interpreter: No such file or directory 原因:window ...
- sh脚本异常,binsh^M bad interpreter No such file or directory
错误 在Linux中执行.sh脚本,出现如下异常 /bin/sh^M: bad interpreter: No such file or directory 原因 在windows系统中编辑的.sh文 ...
- docker容器启动时执行脚本 run /bin/bash执行多条指令
搜了很多资料发现并未解决,以下方法失败!求大神评论给出完美方案 1.首先需要编写需要启动的脚本,并将脚本放在 /etc/init.d/目录下 如:cs.sh 2.修改权限 3.chkconfig -- ...
随机推荐
- DNS原理及其解析过程【精彩剖析】(转)
2012-03-21 17:23:10 标签:dig wireshark bind nslookup dns 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否 ...
- hiho一下第88周《Coordinates》
题目大意 给定数字P,Q,求出所有P和Q的约数p,q能够组成的不重复数字对(p,q) 解题思路 作为本场比赛的第一题,本题的难度在于考察选手是否有基本的编程能力. 本题中需要求出P,Q所有约数组成的数 ...
- 关于C语言的printf输出问题
前端面试的时候老总居然问这个问题,有点震惊…… #include <stdio.h> #include <stdlib.h> void main() { ; printf(&q ...
- 【OpenStack】OpenStack系列13之Nova源码解析与API扩展
学习思路 议程:代码结构-主干流程-分层架构-业务模型-数据库模型-消息模型 分布式架构:Api:横向扩展 rpc:纵向扩展 分层架构:Controller接口层.View/Manager逻辑层 ...
- Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. Example Given 1-> ...
- Swap Two Nodes in Linked List
Given a linked list and two values v1 and v2. Swap the two nodes in the linked list with values v1 a ...
- h5在微信中不允许放大缩小页面
在头部添加 <meta name="viewport" content="width=device-width, initial-scale=1, maximum- ...
- HDU 5514 Frogs (容斥原理+因子分解)
题目链接 题意:有n只青蛙,m个石头(围成圆圈).第i只青蛙每次只能条ai个石头,问最后所有青蛙跳过的石头的下标总和是多少? 题解:暴力肯定会超时,首先分解出m的因子,自己本身不用分,因为石头编号是0 ...
- 正则和xml解析
一般来说是xml解析的开销比正则大些.使用正则搜索,只需搜索<second>就能定位到你要的内容,而xml解析要把节点树在内存中建立起来,所以消耗内存会多些,速度可能会受到一些影响.但对于 ...
- javascript输出AscII码扩展集中的字符
function test(){ var c=""; for(var i=1;i<65536;i++){ if((i%10)==0){ c+=i+':\t'+String.f ...