Title: shell bash 模版填充ENV

Categories: shell bash

Description: 通过环境变量来初始化模版数据

Keywords: storm bash shell 替换 模版

quick start

#!/bin/bash
ZK_IP="192.168.1.1"
cat ${template_path} |
awk '$0 !~ /^\s*#.*$/' |
sed 's/[ "]/\\&/g' |
while read -r line;do
    eval echo ${line}
done >${dst_path}

转载请注明出处,本文采用 CC4.0 协议授权