ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morten Mortensen <>
Subject Q: Double-expansion - reading environment variables "dynamically" ?
Date Sun, 06 Jul 2003 03:30:19 GMT

Given a defined property "x" assigned the name of an environment-variable,
how do I read the value of the environment-variable?

I can read the environment-variable "XXX_HOME" by introducing the
environment as "env" and using "${env.XXX_HOME}" in my Ant-file.

But what if "XXX_HOME" is specified as the value of a property?

Constructed example:

    <property environment="env"/>

    <!-- Property wired here for the example; is to be read by other means:
    <property name="x" value="XXX_HOME"/>

    <!-- Gee, does some kind of double-expansion work?: -->
    <property name="v" value="${env.${x}}"/>

    <!-- Would like to see the value identical to "${env.XXX_HOME}" here:
    <echo>Result: ${v}</echo>

If anyone knows how to do this, please tell me how.


Morten Sabroe Mortensen 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message