Skip to content

Instantly share code, notes, and snippets.

@mikeslattery
Last active May 15, 2019 21:44
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 mikeslattery/8a355ddaa0bef42c3425e308fbacc540 to your computer and use it in GitHub Desktop.
Save mikeslattery/8a355ddaa0bef42c3425e308fbacc540 to your computer and use it in GitHub Desktop.
Template engine for Bash
#!/bin/bash
# Interpolates variables in a text file
# $1 = template filename
templatefile="$1"
shift
eval "$(echo -e "cat <<HEREX\n$(cat "$templatefile")\nHEREX\n")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment