bash – 语法错误:文件结束意外(期待“fi”)
发布时间:2020-12-16 01:22:08 所属栏目:安全 来源:网络整理
导读:我在bash中写一个makefile,我有一个目标,我试图找到一个文件是否存在,即使我认为语法是正确的,我仍然给我一个错误. 这是我试图运行的脚本 read: if [ -e testFile] ; then cat testFile fi 我使用的标签,这不是一个问题. 错误是(当我输入:“make read”)
我在bash中写一个makefile,我有一个目标,我试图找到一个文件是否存在,即使我认为语法是正确的,我仍然给我一个错误.
这是我试图运行的脚本 read: if [ -e testFile] ; then cat testFile fi 我使用的标签,这不是一个问题. 错误是(当我输入:“make read”) if [ -e testFile] ; then cat testFile fi /bin/sh: Syntax error: end of file unexpected (expecting "fi") make: *** [read] Error 2
尝试在cat testFile之后添加分号.例如:
read: if [ -e testFile ] ; then cat testFile ; fi 或者: read: test -r testFile && cat testFile (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |