You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sergei Dubov <sd...@gmail.com> on 2006/01/24 21:47:33 UTC

Checking for non-existence of environment variable

Hi guys,

I am sure this question has been asked before. But I did my research and 
found no answers whatsoever.

Basically I am trying to check for existence of an environment variable. 
And if it is not defined I want the script to fail.

<project name="base" basedir="." default="echo-env">
     <property environment="env"/>

     <target name="echo-env">
         <echo>${env.NO_VALUE}</echo>
     </target>
</project>

Basically this will return "${env.NO_VALUE}".

And potential <available> check will think it actually HAS value. Is 
there any way to make Ant recognize that System.getenv("NO_VALUE") 
returns null?

Thank you very much beforehand,

Serge.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org