Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t从ant命令输出bash中的结果_Bash_Ant - Fatal编程技术网

Can';t从ant命令输出bash中的结果

Can';t从ant命令输出bash中的结果,bash,ant,Bash,Ant,我正在编写一个bash脚本,它修改一些配置文件,以不同的用户身份运行“ant ear war”,输出返回,退出到根目录以继续脚本的其余部分。问题是脚本在退出后不会继续,并且我没有从“ant ear war”中获得输出 谢谢你的帮助 这里有一个例子 #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 t

我正在编写一个bash脚本,它修改一些配置文件,以不同的用户身份运行“ant ear war”,输出返回,退出到根目录以继续脚本的其余部分。问题是脚本在退出后不会继续,并且我没有从“ant ear war”中获得输出

谢谢你的帮助

这里有一个例子

#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#"

将要在不同用户上下文中运行的命令放入单独的脚本中,并通过

su another_user -c /path/to/other.sh