Bash的语法错误:意外的文件结束 [英] Bash syntax error: unexpected end of file
本文介绍了Bash的语法错误:意外的文件结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请原谅我这是一个猛砸非常简单的脚本。这里的code:
#!/斌/庆典
#2011年6月如果[$#-lt 3 -o $#-gt 3];然后
回声错误...用法:$ 0主机数据库中的用户名
退出0
科幻
运行SH file.sh后:
语法错误:意外的文件结尾
块引用>解决方案我觉得file.sh是CRLF行结束符。
运行
DOS2UNIX的file.sh
那么问题将得到解决。
您可以在Ubuntu这个安装DOS2UNIX的:
命令和apt-get安装DOS2UNIX的
Forgive me for this is a very simple script in Bash. Here's the code:
#!/bin/bash # june 2011 if [ $# -lt 3 -o $# -gt 3 ]; then echo "Error... Usage: $0 host database username" exit 0 fi
after running sh file.sh:
syntax error: unexpected end of file
解决方案I think file.sh is with CRLF line terminators.
run
dos2unix file.sh
then the problem will be fixed.
You can install dos2unix in ubuntu with this:
sudo apt-get install dos2unix
这篇关于Bash的语法错误:意外的文件结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文