Quantcast
Viewing latest article 36
Browse Latest Browse All 49

Comment by David Z on jq pass argument as a key to new field

@somenxavier In general I would suggest asking followup questions as their own separate posts, not as comments. But since this one is quick, I'll tell you that it's because $md is part of a string, and variables are not interpolated in strings in jq. You need to mark interpolation sequences explicitly with \(...). Try jq --arg md "foo" '. += {'content': "\($md)"}' blog.json to see interpolation in action, or jq --arg md "foo" '. += {'content': $md}' blog.json to see how to reference the variable $md directly.

Viewing latest article 36
Browse Latest Browse All 49

Trending Articles



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