【发布时间】:2019-07-10 07:47:46
【问题描述】:
我想在我的 json 中使用 jq for Storage 和 Container 捕获一个值,以便在 bash 中将其作为变量传递,但我在解析它时遇到问题。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"Containers": {
"value": [
{
"Storage": "abdelvt33cpgsa",
"RG": "samitestik2",
"Container": "lama"
},
{
"Storage": "abdelvt44cpgsa",
"RG": "samitestik2",
"Container": "baba"
}
]
}
}
}
预期的结果是 x = abdelvt33cpgsa 和 y = lama
【问题讨论】:
-
value[]中有两个条目,为什么只需要第一个? -
@Inian 我将在每个循环中遍历它们,我将使用存储和容器的值之一来部署