json文件如下:
{"name" :"sam",
"age":23,
"designation":"doctor"}
现在我想使用 bash 脚本在文件末尾添加另一个 json 对象 {"location":"canada"} 我尝试过 echo "{"location":"canada"}">>sample.json
但结果
{"name" :"sam",
"age":23,
"designation":"doctor"} {location:canada}
但我希望它是这样的
{"name" :"sam",
"age":23,
"designation":"doctor",
"location":"canada"}
请建议我