关于shell文件中出现syntax error: unexpected end of file
来源:互联网 发布:阿里云服务器安装镜像 编辑:程序博客网 时间:2024/06/05 11:21
有两种情况会出现这种错误
1.你在window下编辑的文件直接拷贝到linux下会报这种错(如果你确定你的文件没有在window下编辑过,可直接看第二种情况)
解决方法:利用dos2unix将文件转换为unix(本人用os,命令brew install dos2unix, centos下用yum,ubuntu用apt-get)
安装完后运行: dos2unix -n profile profile 就解决了
2.如果第一种情况转换后还有问题,说明你程序内部出现了问题
一般分为两种:if语句没有fi结尾,for循环没有done结尾。
正确的用法如下
if [];
then
echo "a"
else
echo "b"
fi
for i in *.sh; do
echo "c"
done
1.你在window下编辑的文件直接拷贝到linux下会报这种错(如果你确定你的文件没有在window下编辑过,可直接看第二种情况)
解决方法:利用dos2unix将文件转换为unix(本人用os,命令brew install dos2unix, centos下用yum,ubuntu用apt-get)
安装完后运行: dos2unix -n profile profile 就解决了
2.如果第一种情况转换后还有问题,说明你程序内部出现了问题
一般分为两种:if语句没有fi结尾,for循环没有done结尾。
正确的用法如下
if [];
then
echo "a"
else
echo "b"
fi
for i in *.sh; do
echo "c"
done
1 0
- 关于shell文件中出现syntax error: unexpected end of file
- shell中出现syntax error: unexpected end of file
- Shell中EOF出现syntax error: unexpected end of file
- shell中出现syntax error: unexpected end of file
- shell:syntax error:unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- Shell 尴尬: syntax error:unexpected end of file
- 解决shell错误:syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- shell脚本“syntax error:unexpected end of file”解决方案
- shell入门的拦路虎:syntax error: unexpected end of file
- shell错误一例 syntax error: unexpected end of file
- Linux Shell syntax error: unexpected end of file
- linux-shell syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误
- SHELL syntax error:unexpected end of file 提示错误
- shell脚本“syntax error:unexpected end of file”解决方案
- SHELL脚本“SYNTAX ERROR:UNEXPECTED END OF FILE”解决方案
- Android Bionic库
- Android去掉标题栏点菜单键程序崩溃
- Boa服务器移植
- 拍拍关闭:C2C模式走向终结?
- verilog中的timescale用法
- 关于shell文件中出现syntax error: unexpected end of file
- boost intrusive_ptr指针
- 自定义控件学习之:追溯以前的优酷菜单
- mongodb常用语句
- [leetcode:7] 字符串转整数的溢出判断
- Android学习指南之十四:Service详解及应用实例
- 一个学生对Linkedlist源码分析注释
- PCA的数学原理
- 使用Spring Session做分布式会话管理