-bash: ./1.sh: /bin/bash^M: bad interpreter: No such file or directory
2、用vim打开文件:vi 文件名。
3、按‘:’号键,输入查看文件的格式命令set ff或set fileformat。

4、可以看到格式是DOS的。

5、再按‘:’键输入set ff=unix 或 set fileformat=unix设置格式为unix的。

6、然后‘:’键后输入wq,保存,再重新运行就可以了。

-bash: ./1.sh: /bin/bash^M: bad interpreter: No such file or directory的更多相关文章
- -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 ...
- 【问题解决】syntax error: unexpected end of file或-bash: ./full_build.sh: /bin/bash^M: bad interpreter: No
在阅读的过程中有不论什么问题,欢迎一起交流 邮箱:1494713801@qq.com QQ:1494713801 运行一个脚本full_build.sh 时, 一直是提示我: -bash: ./ ...
- 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' ;; ...
- -bash: ./switch.sh: /bin/bash^M: bad interpreter: No such file or directory
问题: 偶然使用 windows 进行编写脚本.使用 wsl (windows subsystem for linux) 进行运行的时候,什么事情没有.但是当把脚本移植到远程服务器进行运行的时候,发现 ...
- bash: ./a.sh: /bin/bash^M: bad interpreter: No such file or directory的解决方法------dos--->unix
一些人喜欢用vim来写linux shell script, 但是, 有的人喜欢在Windows下用一些方便的编辑器(比如鼎鼎大名的Notepad++)写好, 然后拷贝文件到linux下, 结果呢, ...
- nagios监控客户端报错/usr/bin/perl^M: bad interpreter: No such file or directory
nagios服务端监控客户端内存时发现监控不上 在客户端直接执行脚本,报错如下: # /usr/local/nagios/libexec/check_memory.pl -w 6% -c 3% -ba ...
- 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 ...
- 执行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 ...
- 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 ...
- -bash: ./xxx.sh: /bin/bash^M: bad interpreter: No such file or directory
问题的原因是在windows下编辑然后上传到linux系统里执行的..sh文件的格式为dos格式.而linux只能执行格式为unix格式的脚本. 不要使用记事本编辑,使用代码编辑器可以正常执行
随机推荐
- golang中通过bufio和os包读取终端中输入的一行带空格的数据
1. 如果读取不带空格的数据可以使用fmt.Scan或fmt.Scanln读取一个或多个值,但是不能读取带空格的数据,可以使用bufio和os两个包结合 package main import ( & ...
- Clang-Format 个人常用配置
Clang-Format 个人常用配置 本文记录 Clang-Format 个人常用配置. 欲了解更多配置选项,可查阅 官方文档. BasedOnStyle: Google AccessModifie ...
- react组件中的类调用construcor、super方法你知道多少?
constructor:在类中作为一个钩子函数,有constructor钩子函数的时候,可以定义state,如果用户不定义state的话,有无constructor钩子函数没啥区别: super:
- java的四种引用:强软弱虚
简介 在JDK 1.2以前的版本中,若一个对象不被任何变量引用,那么程序就无法再使用这个对象.也就是说,只有对象处于(reachable)可达状态,程序才能使用它. 从JDK 1.2版本开始,对象的引 ...
- docker容器编排 (4)
容器编排 我们的项目可能会使用了多个容器,容器多了之后管理容器的工作就会变得麻烦.如果要对多个容器进行自动配置使得容器可以相互协作甚至实现复杂的调度,这就需要进行容器编排.Docker原生对容器编排的 ...
- VC 模拟键盘输入
转载请注明来源:https://www.cnblogs.com/hookjc/ vc模拟键盘输入keybd_event(VK_LWIN, 0, 0 ,0);keybd_event('M', 0, 0 ...
- 一致性协议之ZAB
前言 一致性协议 包括 Paxos,Raft,2PC,3PC等等,今天我们讲一种协议,ZAB 协议,该协议应该是所有一致性协议中生产环境中应用最多的了.为什么呢?因为他是为 Zookeeper 设计的 ...
- Maven多环境配置实战 filter
目前在开发一个wap项目,主要有开发.测试和最终部署上线几个阶段,每个阶段对配置(数据库.日志)都有不同的设置.以前都是以开发环境为主,在测试和部署上线时由部署工程师负责修改配置并上线.但是公司并非都 ...
- shell脚本之数组基本操作及排序
数组的基本操作及排序 1.数组定义方法: ( 6 7 9 4 3 2) 0 1 2 3 4 5 #下标号 方法一: 数组名=(value0 value1 value2 -) 方法二: 数组名=([0] ...
- Linux远程访问及控制
Linux远程访问及控制 目录 Linux远程访问及控制 一.SSH远程管理 1. SSH远程管理概述 2. OpenSSH概述 3. 配置OpenSSH服务端 4. sshd服务的验证方式 5. 使 ...