I have input.sh shell script which asks for user input,it works fine!!. Now i want to call input.sh through ant,i am able to do that but i'm not able to pass the input to the shell script. I have missed anything? Below is the snipped for build.xml and input.sh with execution result.
input.sh
#!/bin/bash
echo "enter the Organization name"
read Orgname
echo "Orgname is : $Orgname"
sed "s/000/$Orgname/g" Final.sql >> ExecuteID.sql
echo "Organization name has been replaced with $Orgname"
Result:
[root@krog2-rhel5-64 Work]# ./input.sh
enter the Organization name
**yak
Orgname is : yak
Organization name has been replaced with yak**
build.xml
<project name="Sample" default="automate">
<target name="automate">
<exec executable="/bin/bash">
<arg value="/root/test/Work/input.sh"/>
<arg value="/root/test/Work"/>
</exec>
</project>
Result:
[root@krog2-rhel5-64 Work]# ant
Buildfile: /root/test/Work/build.xml
automate:
[exec] enter the Organization name
[exec] **Orgname is :
[exec] Organization name has been replaced with**
BUILD SUCCESSFUL
Total time: 0 seconds
Any help in this matter will be greatly appreciated!!