ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pankaj Kumar <>
Subject How to test whether a particular environment variable is set or not
Date Tue, 09 Aug 2005 14:41:31 GMT
Hi Folks,

I want to set a property to the value of an environment variable if
that variable is set, otherwise to a different string.

I am able to do this with the following:

    <property environment="env" />
    <property name="test.home.0" value="${env.TEST_HOME}"/>
    <condition property="test.home" value="TO_BE_REPLACED">
      <equals arg1="${test.home.0}" arg2="\${env.TEST_HOME}"/>
    <property name="test.home" value="${env.TEST_HOME}"/>
    <target name="test">
      <echo>TEST_HOME: ${test.home}</echo>

Is there a better (read: less verbose) way?

Pankaj Kumar.

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

View raw message