1
我正在編寫一個修改某些配置文件的bash腳本,以不同的用戶身份運行「ant ear war」,輸出返回值,退出到根目錄以繼續腳本的其餘部分。問題在於腳本在退出後不會繼續,並且我沒有從「ant ear war」中獲得輸出。無法從螞蟻命令輸出bash結果
謝謝你的幫助。
這裏有一個例子
#When running the bash script i don't see the output. Maybe it's because I run it as root and switched to another_user. So I tried to outputing result into a variable and into a text file. Both failed
su another_user
cd /usr/empi/MMEMPIV741/
echo $(ant ear war) >> /tmp/empi_install.txt
varant="$?"
echo 'if zero it's success otherwise it's a failure'
cp /usr/accessmgr/AMV741/bin/am/JBoss/AccessManager.war /usr/jboss/jboss-eap-4.3/jboss-as/server/default/deploy/
cp /usr/empi/MMEMPIV741/person_project/working-dir/dist/* /usr/jboss/jboss-eap-4.3/jboss-as/server/default/deploy/
exit
#By this time above is exited from another_user and should return to root
echo $varant
echo "http://`hostname`:21080/PersonMasterIndexDQM/flex/login.jsp#"
是非常完美運行該腳本的命令。謝謝。 – Igor 2013-05-01 19:00:05