我对 bash 脚本非常陌生,正在尝试在我的 Makefile 中添加 bash 脚本。我有一个
errors.json
文件。如何在 Makefile 中编写 bash 脚本来检查文件是否有任何内容。如果它不为空,则回显 error.json
文件的内容,否则完成。下面是伪代码:
if [[ !error.json.isEmpty() ]]; then \
cat error.json; \
delete the error.json; \
else \
delete the error.json;
fi
cat error.json 2>/dev/null
rm error.json