GeeCON Prague 2014*
The moose likes Ant, Maven and Other Build Tools and the fly likes Running a shell script from ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Running a shell script from ANT" Watch "Running a shell script from ANT" New topic
Author

Running a shell script from ANT

Ram Charan
Greenhorn

Joined: Apr 07, 2004
Posts: 12
I need to run two shell scripts in sequece from ANT. The first one sets up some environment variables and the second one uses them to run IDL compiler. Here is the sequence of steps

1) When I login to unix, i will be in csh
2) The fist script should run in ksh and sets up environment variables
3) The second scripts should also run in same ksh and execute IDL compile

I do this from command line and it works.
1) When I login to Unix, I am in csh, so I just change shell by typing sh
2) I run a build.xml (using ant) that runs following.


So, I added an other exec task before the above task to change the shell using this:


But when I run the build.xml, I see that the shell has not changed. My questions are:
1) how do I change unix shells from ANT? I tried invoking a wrapper script that changes the shell and calling it from ANT but it did not work.
2) If there is a way to setup/change environment variables of Unix from ANT, I think my problem is solved.

Any help is greatly appreciated.

Thanks,
Ram Charan


thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16101
    
  21

Probably the easiest solution is to write another shell script that does all of the above and invoke it from Ant.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Running a shell script from ANT