I`m trying to do a bash script for a checkpoint management server api and I am experiencing some problems. I want to get the value in a json dictionary and for that I have to use variables. I am entering this command:
echo $rulebase | jq --arg n "$0" '.rulebase[$n].to'
and I get the next error:
jq: error: Cannot index array with string
However, If i use :
echo $rulebase | jq '.rulebase[0].to'
I get the result that I need. I dont know how to use the variables when they are a number, can anyone help me?