I want to read environment variables from .json-file:
{
"PASSPHRASE": "$(cat /home/x/secret)",
}
With the following script:
IFS=$'\n'
for s in $(echo $values | jq -r "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]" $1); do
export $s
echo $s
done
unset IFS
But the I got $(cat /home/x/secret)
in PASSPHRASE
, and cat
is not executed. When I execute the line export PASSPHRASE=$(cat /home/x/secret)
, I got the correct result (content of file in environment variable). What do I have to change on my script, to get it working?