Do substitution with bash


We had a some page that were previously using the apache SSI which we will no longer use. I made a script to do the substitution like the apache did.

#!/bin/bash

APP_HOST="https://order.test.com"
APP_TOKEN="TOKEN"

sed -i -f <(
  for v in APP_HOST APP_TOKEN; do
    eval value='$'$v
    echo 's/<!--#echo var="'$v'" -->/'${value//\//\\/}'/g'
  done
) dist/app.js

Leave a Reply

Your email address will not be published.