Created
December 31, 2015 03:48
-
-
Save Azerothian/b3500e3d83aa277377a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
TEMPLATE_FILE=$1 | |
ENV_PREFIX=$2 | |
env | grep "^$ENV_PREFIX" | while IFS="=" read -r name value; do | |
printf "s/%s/%q/\n" "${name}" "$value" | |
done > sed-script.txt | |
cat sed-script.txt # Optional | |
sed -f sed-script.txt "$TEMPLATE_FILE" | |
rm sed-script.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment