sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

env var templating #48

Closed sc0ttj closed 5 years ago

sc0ttj commented 5 years ago

Here's how to apply environment variables to template file (no backup need).

  1. Create template with {{FOO}} for later replace. echo "Hello {{FOO}}" > foo.conf.tmpl

  2. Replace {{FOO}} with FOO variable and output to new foo.conf file FOO="world" && sed -e "s/{{FOO}}/$FOO/g" foo.conf.tmpl > foo.conf

Working on both macOS 10.12.4 and Ubuntu 14.04.5