ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis Galiegue <...@one2team.com>
Subject Re: Unix Home set in Build.xml
Date Sat, 09 May 2009 21:29:48 GMT
Le Saturday 09 May 2009 13:27:45 Rajesh Kumar (IN4774), vous avez écrit :
> Hi,
>
> I want to set one properties HOMEDIR in build.xml which will be set through
> user logged in the current system..
>
> How to read Unix home directory and put that value in build.xml
>

Use ant's <property> with the environment attribute:

----
<project name="test" default="myhome">
    <property environment="env"/>

    <target name="myhome">
        <echo message="My home is ${env.HOME}"/>
    </target>
</project>
----

As you can see, you can source whatever your environment is with a given 
prefix (here "env", it could have been anything else) and then access any 
defined environment variable with ${env.xxxx}.

HOME is standard on Unix. YMMV.

-- 
Francis Galiegue
fge@one2team.com
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
One2team
40 avenue Raymond Poincaré
75116 Paris

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


Mime
View raw message