在gnu制作中使用grep
首先:我是Linux的新手,我已经很抱歉问一个可能的愚蠢问题。
我有一个将乳胶文本编译成pdf的makefile。这会创建一个日志文件,我必须在该日志文件中搜索一个字符串,并在字符串中在日志文件中再次编译。 因此,一切都可以正常运行,直到我的命令为止。 我正在尝试使用GREP命令检查子弦,但不要让它起作用。 在我的解决方案中,即使子字符串不在我的日志文件中,也执行IF语句。
GREP_FINDINGS := $(shell grep 'undefhrined' linux-20.log)
all: clean linux-20.pdf
ifeq ($(GREP_FINDINGS),)
pdflatex linux-20
endif
linux-20.pdf:
pdflatex linux-20
bibtex linux-20
pdflatex linux-20
.PHONY: clean
clean:
echo Cleaning .aux .bbl .blg .log files
-rm -f *.aux *.bbl *.blg *.log *.pdf
echo Cleaning complete.
First: I'm pretty new to linux and I'm already sorry for asking a probably dumb question.
I have a makefile that compiles a latex text into a pdf. That creates a logfile and I have to search for a string in that log file and compile again if the string is in the log-file.
So everything works fine until to the point of my if-statement.
I'm trying to check for the sub-string with the grep command but dont get it to work.
In my solution the if statement is executed even if the substring is not in my logfile.
GREP_FINDINGS := $(shell grep 'undefhrined' linux-20.log)
all: clean linux-20.pdf
ifeq ($(GREP_FINDINGS),)
pdflatex linux-20
endif
linux-20.pdf:
pdflatex linux-20
bibtex linux-20
pdflatex linux-20
.PHONY: clean
clean:
echo Cleaning .aux .bbl .blg .log files
-rm -f *.aux *.bbl *.blg *.log *.pdf
echo Cleaning complete.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题的某些部分使我感到不安(例如第一个通过后的某些东西是 不确定的,但第二个是在第二次 - 或第三次之后?),但是如果您要的是什么?想要,然后我将有条件的条件放入规则中:
Some parts of this question make me uneasy (such as something being undefined after the first pass but all square after the second -- or third?), but if what you're asking for is actually what you want, then I'd put the conditional inside the rule: