适用场景
将多个命令的输出转换为 JSON。 本条为命令参考与排查示例;请先确认命令已安装,再按示例定位实际参数和输出。
jc
将多个命令的输出转换为 JSON。 更多信息:https://github.com/kellyjonbrazil/jc#usage。
- 通过管道将命令输出转换为 JSON:
{{ifconfig}} | jc {{--ifconfig}}
- 通过魔术语法将命令输出转换为 JSON:
jc {{ifconfig}}
- 通过管道输出格式化的 JSON:
{{ifconfig}} | jc {{--ifconfig}} {{[-p|--pretty]}}
- 通过魔术语法输出格式化的 JSON:
jc {{[-p|--pretty]}} {{ifconfig}}