通过 Ant exec 运行多个命令 [英] Run multiple commands through Ant exec
本文介绍了通过 Ant exec 运行多个命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 Ant 构建脚本来做到这一点:
I want to do this through an Ant build script:
$ /bin/sh
$ cd /path/to/executable
$ ./executable.sh
这是我尝试过的,但我认为它只执行 cd
命令:
This is what I tried but I think it only executes the cd
command:
<exec executable="/bin/sh" os="Mac OS X">
<arg value="-c"/>
<arg value="cd /path/to/executable"/>
<arg value="./executable.sh"/>
</exec>
我使用的是 Mac OS X.
I am on Mac OS X.
推荐答案
只有 -c
之后的第一个 arg 由 shell 运行,因此是您看到的行为.只需将这两个命令放在一个 arg 中,用分号分隔:
Only the first arg after the -c
is run by the shell, hence the behaviour you see. Just put the two commands into one arg, separated by a semicolon:
<exec executable="/bin/sh" os="Mac OS X">
<arg value="-c"/>
<arg value="cd /path/to/executable; ./executable.sh"/>
</exec>
这篇关于通过 Ant exec 运行多个命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文