Hi developers,

I seem to have zero luck on the users-list... I am getting pretty
impatient...

To repeat: Given a defined property assigned the name of an
environment-variable, how do I read the value of the
environment-variable?

Can it be done? How?

     ?

Regards,
Morten Sabroe Mortensen


-----Original Message-----
From: Morten Mortensen
To: 'user@ant.apache.org'
Sent: 06-07-03 05:30
Subject: Q: Double-expansion - reading environment variables "dynamically"?


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:

  <target
    name="test"
  >
    <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>
  </target>


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

    ?

Morten Sabroe Mortensen 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to