Skip to content

Instantly share code, notes, and snippets.

@joshuamckenty
Created January 24, 2014 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuamckenty/8592327 to your computer and use it in GitHub Desktop.
Save joshuamckenty/8592327 to your computer and use it in GitHub Desktop.
replace.sh
#!/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