How to escape dash in jq call?
cat afile | jq -r .commit-sha1
So the dash is being interpreted in some way. How to escape it? I tried wrap with "
>Solution :
For such keys, you need to quote the key, but the quotes must also be quoted so that they aren’t removed by the shell prior to running jq.
jq -r '."commit-sha1"'
The abbreviated from .foo is for "simple, identifier-like keys", according to the man page.