Reading data from a file using Ant

R

rynox

Hi Everyone,

Im new to Ant and I am encountering some problems.
I have a text file which contains a value in there. I need that value
to be set into another file.
I tried using Javascript but Javascript does not support I/O for files.
Is there any command in Ant that can read a value from a text file (
eg. output.txt ) and then use that value to replace into another file (
eg. jsp ).

Thanks,
Marvin
 
R

Roedy Green

Im new to Ant and I am encountering some problems.
I have a text file which contains a value in there. I need that value
to be set into another file.
I tried using Javascript but Javascript does not support I/O for files.
Is there any command in Ant that can read a value from a text file (
eg. output.txt ) and then use that value to replace into another file (
eg. jsp ).

see http://mindprod.com/jgloss/multiposting.html
 
R

Roedy Green

There dont seem to be any syntax that shows how i can retrieve a value.

Want you want is a way to read a small amount of text from a file and
put it into an ANT property?

Look at the LOADFILE task.
 
Joined
May 22, 2009
Messages
1
Reaction score
0
Hello,

This works, but I have the following situation:

I have an ant script that we use to deploy code. The user logs on with their id and then uses 'su' command to switch over to a user called ant.

At this time, I can use the "logname" command to get which user is logged on to the system. This returns the original username but not ant.

I need this userid to find out whether this user has access to deploy the code.

However when I try to run this command from an ant script, I do not get any output.

Can anyone help me figure out how to get the loginname or the result of this command through the ant script so that I can use it.

FYI here is the script that I use:

<target name="main" >

<exec executable ="/bin/sh">
<arg value = "-c" />
<arg value = "logname" />
</exec>

and here is the output that I get:

main:
[exec] logname: no login name
[exec] Result: 1

BUILD SUCCESSFUL
Total time: 0 seconds

Can someone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top