linux中解决bash脚本执行提示/bin/sh^M: bad interpreter错误
场景:Linux中启动启动脚本的时候报
/etc/init.d/umpctrl: /opt/ump/scripts/start.sh: /bin/sh^M: bad interpreter: No such file or directory
分析问题:进入/opt/ump/scripts/目录中使用vi start.sh指令,查看start.sh的格式是doc,可能是在Windows中打开start.sh文件,并且保存了
解决方法一:是用vi start.sh然后按ESC键然后输入“:”然后输入set ff=unix 保存退出再次查看start.sh的格式变成unix了问题解决,此种方法不彻底啊有时候,打开文件的时候会在每行文件结尾有^M的标志
解决方法二:使用vi start.sh 然后使用命令:doc2unix命令
如果此命令没有安装的话,使用yum -y install dos2unix
chy love orange
They have known each other for 7 years and have been in love for two years.
posted on 2018-09-17 14:02 lalala1_23 阅读(645) 评论(0) 收藏 举报
浙公网安备 33010602011771号