Skip to content

Instantly share code, notes, and snippets.

@andgineer
Created March 6, 2021 11:53
Show Gist options
  • Save andgineer/649cf11bf8af092c886857b8abc79a9e to your computer and use it in GitHub Desktop.
Save andgineer/649cf11bf8af092c886857b8abc79a9e to your computer and use it in GitHub Desktop.
Substitute placeholders in config like ${name} with all env vars defined in current session
for VAR in $(compgen -e); do
# to work in zsh replace `${!VAR}` with `${(P)VAR}`
sed -i 's|${'$VAR'}|'"${!VAR}"'|g' /config.yml
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment