打印 json 文件内容的 Bash 脚本

问题描述 投票:0回答:1

我对 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
linux bash shell makefile terminal
1个回答
0
投票
cat error.json 2>/dev/null
rm error.json
© www.soinside.com 2019 - 2024. All rights reserved.