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

How to use json data from an existing object to update an other object?

$
0
0

Here is my first input (recorded as bash var $services)

{"key": "movies-wikibase-jobrunner","subPath": "LocalSettings.php","cm": "movies-wikibase-jobrunner-localsettings-override-php"}{"key": "movies-wikibase-wdqs-frontend","subPath": "wdqs_front_index.html","cm": "movies-wikibase-wdqs-frontend-index-html"}

I'd like to use subPath to update deployment.json.I tried to pass subPath as a bash argument to jq but nothing works

cat deployment.json | jq -r --arg services $services '((.spec.template.spec.containers[].volumeMounts[]? )) |= {mountPath: .mountPath, name: (.key, subPath: $services|select(.key=="movies-wikibase-wdqs-frontend").subPath})'

How can I achieve this, and is this the good way?


Viewing all articles
Browse latest Browse all 657

Trending Articles



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