我有 input.sh shell 脚本,它要求用户输入,它工作正常!!。现在我想通过 ant 调用 input.sh,我可以这样做,但我无法将输入传递给 shell 脚本。我错过了什么?下面是带有执行结果的 build.xml 和 input.sh 的片段。
输入.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"
结果:
[root@krog2-rhel5-64 Work]# ./input.sh
enter the Organization name
**yak
Orgname is : yak
Organization name has been replaced with yak**
构建.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>
结果:
[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
在这件事上的任何帮助将不胜感激!