如何替换文件中的环境变量
2023-06-07 本文已影响0人
CodingCode
- 使用envsubst
$ envsubst <infile >outfile
! /bin/sh
cat <<EOF
<property>
<name>instanceId</name>
<value>$INSTANCE_ID</value>
</property>
EOF
- 使用envsubst
$ envsubst <infile >outfile
cat <<EOF
<property>
<name>instanceId</name>
<value>$INSTANCE_ID</value>
</property>
EOF