Trying to figure out the syntax for jq. This line works absolutely fine:
echo $(cat ../post-auth/rkt-auth.json | jq -c --arg user ${vsphere_user} '.credentials.user = $user') > ../post-auth/rkt-auth.json
However this is not the case when variable is a part of json path:
echo $(cat ../post-auth/docker-auth.json | jq -c --arg basejq ${base} --arg tempvarjq ${tempvar} '.auths.$tempvarjq.auth= $basejq') > ../post-auth/docker-auth.json
Error:
jq: error: syntax error, unexpected '$', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.auths.$tempvarjq.auth= $basejq
jq: 1 compile error
Any suggestions how to correct this syntax with that variable?