Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
render-template() {
declare filename="$1"; shift
local script k v
for var in "$@"; do
IFS='=' read k v <<< "$var"
cat "$filename" | sed "$script"
# usage: render-template /path/to/template foo=bar baz=qux
# replaces $$foo and $$baz in template to values bar and qux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment