我有一个名为 Call.sh 的 shell 脚本,它在内部调用其他脚本(即 .sh)并且对我来说工作正常。现在我想从ant实用程序执行 Call.sh。我制作了一个调用 .sh 的 build.xml。但是其中一个脚本要求输入,但 ant 没有让我有机会提供输入,因为进一步的操作失败了。请找到以下代码
构建.xml
<project name="Sample" default="info">
<target name="info">
<exec executable="/bin/bash">
<arg value="/full path/Call.sh"/>
<arg value="/tmp"/>
</exec>
</target>
</project>
调用.sh
#!/bin/bash
echo "Begining the execution......"
sleep 1
sh ./input.sh
sh ./AutomateCom.sh
sh ./Clean.sh
echo "*****_______*****_______"
输入.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"
当我运行蚂蚁时:它连续运行....下面是我说蚂蚁时的 o/p
[root@krog2-rhel5-64 Work]# ant
Buildfile: /root/test/Work/build.xml
info:
[exec] enter the Organization name
[exec] Orgname is :
[exec] Organization name has been replaced with
BUILD SUCCESSFUL
Total time: 0 seconds
......................................
当我运行 ./input.sh 时,我期望什么,以同样的方式 ant 应该要求我输入
[root@krog2-rhel5-64 Work]# ./input.sh
enter the Organization name
**yak**
Orgname is : yak
Organization name has been replaced with yak
However ant doesn't give me opportunity to prompt for the user input. Any suggestions.