I am using this bash command to write the json http response body into a file:
curl -s "http://some.domain.com/getSomeJson" | jq . | tee someJson.json;
But what I really want is something like this:
curl -s "http://some.domain.com/getSomeJson" | jq . | tee someJson-THE_VALUE_OF_A_SPECIFIC_RESPONSE_HEADER_NAMED_X-FOO-BAR.json
So, in natural language:
I want to write the response of the cURL request into a file, preserving its pretty formatted json content, while at the same time use one of the response headers as part of the filename of said file.
I don't really care at which point the jq part happens in the command as long as the file content in the end is pretty formatted json.