- 使用 jq 格式化 json 文本后再存入 json 文件,但不回显 json 内容
jq . << EOF > example.json
[{
"Classification": "hdfs-site",
"Properties": {"dfs.replication": "1"}
}]
EOF
cat example.json
- 使用 jq 格式化 json 文本后再存入 json 文件,同时回显 json 内容(无 jq 语法着色)
jq . << EOF | tee example.json | jq
[{
"Classification": "hdfs-site",
"Properties": {"dfs.replication": "1"}
}]
EOF
cat example.json
- 使用 jq 格式化 json 文本后再存入 json 文件,同时回显 json 内容(有 jq 语法着色)
jq . << EOF | tee example.json | jq
[{
"Classification": "hdfs-site",
"Properties": {"dfs.replication": "1"}
}]
EOF
cat example.json