Created
January 24, 2014 05:02
-
-
Save joshuamckenty/8592327 to your computer and use it in GitHub Desktop.
replace.sh
This file contains 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
#!/bin/bash | |
if [ $# -ne 3 ]; then | |
echo "USAGE: | |
./$0 template.txt destination.txt variables.txt" | |
exit 1 | |
fi | |
echo "#!/bin/bash | |
cat > $2 << EOF | |
`cat $1` | |
EOF" > $2; | |
chmod +x $2; | |
# load variables into env | |
. $3 | |
# actually replace variables | |
./$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment