There is extra code in here, but the key takeaway is:
- Use
jq
to convert an object with key/value pairs, into a key=value string list - Feed that listinto a
while
loop, which then exports the environment variables
While this is done in a script, it needs to live in a function, if the environment variables are supposed to persist in the current shell.