Passing bash shell variable to jq filter

前端 未结 1 1556
走了就别回头了
走了就别回头了 2021-01-17 03:58

Trying to pass a bash shell variable into a jq filter

JSON:

{
\"server1\": {
\"port\": 3333,
\"name\": \"foo\",
\"timesincelast\": 248054
},
\"server         


        
相关标签:
1条回答
  • 2021-01-17 04:40

    You could write:

    .[$servername] | .port
    

    or simply:

    .[$servername].port
    
    0 讨论(0)
提交回复
热议问题