4 ms·
Instead of `m4` or `sed` find and replace, the author should try `envsubst`. It's a program that replaces bash style variable references (for example `$TITLE`)
by envsubst 3y ago
Instead of `m4` or `sed` find and replace, the author should try `envsubst`. It's a program that replaces bash style variable references (for example `$TITLE`) with their value in the environment.
export CURRENT="..."
cat page.html | envsubt
- teo_zero 3y agoThe problem is that the $SOMETHING syntax is just too common if your site is a technical one, and you'll end up substituting too much.
- envsubst 3y agoYou can specify which variable names are valid, reducing the likelihood of a collision.
- karl42 3y agoI agree that `envsubst` is a good choice for this. Unfortunately, it is not part of posix, so you can't rely on it being present everywhere. But as part of gettext, it is still very common.