shell jq 迭代处理json数组

cat ../2.json | jq 'map("curl -o " + .id + ".jpg "+ .avatar)|.[]'

2.json 内容; 

[
  {
    "id": "281",
    "avatar": "https://nim-nosdn.netease.im/MTEyNzU4MDQ=/bmltYV8xMjg0MTE3MTkyN18xNjA4MTI1MjM4MjQ1X2U5ZTYzMjVjLTViZGItNGNmMC1hOTAzLTFjMzhmMTcxN2RlMw=="
  },
  {
    "id": "282",
    "avatar": "https://nim-nosdn.netease.im/MTEyNzU4MDQ=/bmltYV8xMjg0MTI2NjQ5MV8xNjU1OTgwNzAxMTYzXzIwM2E0YjJkLTk1ZDUtNDQyYS04OGY3LWJhNGJmODZjMGViMA=="
  }
}

你可能感兴趣的:(json,linux,运维)