我有一個名爲Call.sh的shell腳本,它在內部調用其他腳本(即.sh)並且對我來說工作正常。現在我想從螞蟻實用程序執行Call.sh。我做了一個調用.sh的build.xml。但其中一個腳本要求輸入,但由於進一步的操作失敗,螞蟻並沒有給我機會提供輸入。請從下面的代碼通過螞蟻執行Shell腳本
在build.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>
Call.sh
#!/bin/bash
echo "Begining the execution......"
sleep 1
sh ./input.sh
sh ./AutomateCom.sh
sh ./Clean.sh
echo "*****_______*****_______"
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"
當我運行螞蟻:它運行汽車無....下面是O/P當我說螞蟻
[[email protected] 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,in同樣的方式螞蟻應該問我要輸入
[[email protected] 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.
你沒有提到這個問題很難找出這裏的問題。嘗試指定'input.sh'的完整路徑。 – devnull
小改變Call.sh.在哪裏指定完整路徑。當我做螞蟻。它構建但沒有任何反應,我的意思是它應該執行Call.sh. – mahesh