当错误发生时,有没有方法输出错误消息?让我们详细介绍一下,我想知道一个文件内容是否等于另一个文件,或者not.If不等于,make应该退出并输出一个错误消息。
test:
cmp --silent tmp/test.txt tmp/test_de.txt || (error DecryptFile is different from original)当tmp/test.txt不等于tmp/test_de.txt时,输出是:
cmp --silent tmp/test.txt tmp/test_de.txt | (error DecryptFile is different from original)
/bin/sh: 1: error: not found
makefile:38: recipe for target 'test' failed
make: *** [test] Error 127/bin/sh: 1:错误:未找到
结果不是我想要的结果,我只想像这样的错误信息:
makefile:38: *** missing separator. Stop.发布于 2017-05-19 05:05:42
您可以使用exit。(和)可以包含多个命令:
cmp --silent tmp/test.txt tmp/test_de.txt || (echo "DecryptFile is different from original"; exit 1)https://stackoverflow.com/questions/44061611
复制相似问题