shell中出现syntax error: unexpected end of file
2015-02-27 17:37
309 查看
写了如下shell,结果运行报syntax error: unexpected end of file
while true
do
sqlplus / as sysdba << EOF!
select sysdate from dual;
此处不顶行写 EOF!
done
原来下面这个EOF!必须要顶行写。如果没有循环!EOF可以随便放什么位置,但是在循环中属于Here Documents,这个EOF!是代表Here Documents的结束。此处不能像写C程序一样,为了美观而把EOF!向右缩进,因为SHELL规定!EOF必须是该行唯一出现的内容,连空格都不能有。因此,这个EOF!就暂时突出在这一行了。
去掉循环,直接写是可以运行的。
sqlplus / as sysdba << EOF!
select sysdate from dual;
EOF! # 前面有没有空格都不受影响
转贴: http://www.tanyangxf.net/2011/05/shell%E4%B8%AD%E5%87%BA%E7%8E%B0syntax-error-unexpected-end-of-file/
while true
do
sqlplus / as sysdba << EOF!
select sysdate from dual;
此处不顶行写 EOF!
done
原来下面这个EOF!必须要顶行写。如果没有循环!EOF可以随便放什么位置,但是在循环中属于Here Documents,这个EOF!是代表Here Documents的结束。此处不能像写C程序一样,为了美观而把EOF!向右缩进,因为SHELL规定!EOF必须是该行唯一出现的内容,连空格都不能有。因此,这个EOF!就暂时突出在这一行了。
去掉循环,直接写是可以运行的。
sqlplus / as sysdba << EOF!
select sysdate from dual;
EOF! # 前面有没有空格都不受影响
转贴: http://www.tanyangxf.net/2011/05/shell%E4%B8%AD%E5%87%BA%E7%8E%B0syntax-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/Starting proxy www-balancer: cannot bind socket--转载
- Shelll 错误 syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误; windows下修改linux文件导致linux文件无法使用
- shell错误一例 syntax error: unexpected end of file
- shell脚本“syntax error:unexpected end of file”解决方案
- linux下执行sh出现异常"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
- php出现如下错误: Parse error: syntax error, unexpected end of file in
- 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/Starting proxy www-balancer: cannot bind socket--转载
- 解决shell错误:syntax error: unexpected end of file