0
我有input.sh shell脚本,它要求用户输入,它工作正常!!现在我想通过ant调用input.sh,我能够做到这一点,但我无法将输入传递给shell脚本。我错过了什么?以下是针对build.xml和input.sh的执行结果。执行通过蚂蚁输入的shell脚本
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"
结果:
[[email protected] 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>
结果:
[[email protected] 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
在这个问题上的任何帮助将不胜感激!
见的http://stackoverflow.com/questions/4176305/ant-exec-task-how-can-i-read-input-from-console-stdin – devnull
可能重复的[通过蚂蚁执行外壳脚本](http://stackoverflow.com/questions/17268696/executing-shell-script-through-ant) –