语法错误:文件意外结束(预计" Fi无线网络和QUOT;) [英] Syntax error : end of file unexpected (expecting "fi")
本文介绍了语法错误:文件意外结束(预计" Fi无线网络和QUOT;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写在bash一个makefile,我有一个目标中,我试图找到文件是否存在,即使我觉得语法是正确的,我仍然给我的错误。
下面是我试图运行脚本
阅读:
如果[-e TESTFILE]然后 \\
猫TESTFILE \\
科幻
我使用的标签,这样是没有问题的。
错误的是(当我输入:读作)
如果[-e TESTFILE]然后 \\
猫TESTFILE \\
科幻
/ bin / sh的:语法错误:文件意外结束(预计网络连接)
使:*** [阅读]错误2
解决方案
尝试猫TESTFILE
后添加一个分号。例如:
阅读:
如果[-e TESTFILE]然后猫TESTFILE;科幻
或者
阅读:
测试-r TESTFILE&放大器;&安培;猫TESTFILE
I am writing a makefile in bash and I have a target in which I try to find if a file exists and even though I think the syntax is correct, i still gives me an error.
Here is the script that I am trying to run
read:
if [ -e testFile] ; then \
cat testFile\
fi
I am using tabs so that is not a problem.
The error is (when I type in: "make read")
if [ -e testFile] ; then \
cat testFile \
fi
/bin/sh: Syntax error: end of file unexpected (expecting "fi")
make: *** [read] Error 2
解决方案
Try adding a semicolon after cat testFile
. For example:
read:
if [ -e testFile ] ; then cat testFile ; fi
alternatively:
read:
test -r testFile && cat testFile
这篇关于语法错误:文件意外结束(预计" Fi无线网络和QUOT;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文