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) –