Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 521

How to use arg substitution in jq as a key

$
0
0

I am trying to use an arg substitution with jq and one of the args needs to be a key.I have tried$reg - error

"$reg" - no sub

\$reg - error

Can this be done?

export USERNAME=joeexport PASSWORD=whateverexport DOCKER_REGISTRY="hub.docker.io"jq -n --arg reg "${DOCKER_REGISTRY}" \        --arg u "$USERNAME" \        --arg p "${PASSWORD}" \        --arg auth "$(echo "$USERNAME:$PASSWORD" | base64)" \'{"auths": {            $reg: {"username": $u,"password": $p,"auth": $auth            }          }        }'

Viewing all articles
Browse latest Browse all 521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>