我有一个打印消息的perl脚本。这个脚本被GNU make调用。在我的GNU make中,我想显示由脚本打印出来的消息并将其存储在一个变量中。如何将输出字符串存储到变量中并在控制台中显示
我正在这样做。
result=`$(PERL) parse.pl report.log` #parse the report
echo $(result) #echo the message here
ifneq ($(strip $$(result)),) #check if message is empty
#if not empty, search for filepath string pattern and exit
echo filepath
exit 1
endif
但它没有显示来自parse.pl的字符串消息。
你有什么要与捕捉到的线路后怎么办?显示你的Makefile的一部分。你捕获到一个shell变量中,但是然后试图回显一个makefile变量(即使你试图回显shell变量,那也不行,因为make在单独的shell进程中运行每行)。 – ysth
我已经更新了更多的细节。我还没有想出如何对$ result执行regex,所以对任何提示都会很高兴。 –