I have some environment variables declared in a YAML file like:
runtime: python37
env_variables:
API_URL: 'https://fake.api.com/'
API_USERNAME: 'fake@email.com'
API_PASSWORD: 'Passwooord'
I would like to export these to environment variables with a script, I can echo the correct syntax but I'm still unable to export them.
sed -nr '/env_variables:/,$ s/ ([A-Z_]+): (.*)/\1=\2/ p' app.yaml | while read assign; do echo $assign; done
This is different that this as in my case the variable name is passed trough the pipe as well.
read a b < <(echo 1 2 3 4 5)
wherea
andb
are after the pipe. Could you please post a working case with my example? – neurino Sep 05 '19 at 13:05export "$name=$value"
,printf -v "$name" "%s" "$value"
,read "$name" <<<"$value"
, ... (Pick one) – muru Sep 05 '19 at 13:15