I'm trying to get a value from the Json and add it to another field of the same json file. I need to do it in a lot of file so I'm using a loop:
for i in $(find . -name \*.txt); do valorAPoner=$(cat $i | jq -r .Name); tmp=$(mktemp); jq -r '.Authentication.ExternalProvider.LdapUserAndDomain |= "$valorAPoner"' $i > "$tmp" && mv "$tmp" $i.json; done
But when I open $i.json it shows me:
{"Name": "dsfdsf","FullName": "xxxxx","Authentication": {"ExternalProvider": {"LdapUserAndDomain": "$valorAPoner"
I see the string literal of the variable (valorAPoner) but I need the value of the variable. Do you know how to answer it?
Thanks