Is there an easy way to substitute/evaluate environment variables in a file? Like let's say I have a file config.xml
that contains:
<property>
<name>instanceId</name>
<value>$INSTANCE_ID</value>
</property>
<property>
<name>rootPath</name>
<value>/services/$SERVICE_NAME</value>
</property>
...etc. I want to replace $INSTANCE_ID
in the file with the value of the INSTANCE_ID
environment variable, $SERVICE_NAME
with the value of the SERVICE_NAME
env var. I won't know a priori which environment vars are needed (or rather, I don't want to have to update the script if someone adds a new environment variable to the config file). Thanks!