贯穿蚂蚁EXEC多个命令(Run multiple commands through Ant exe

2019-08-04 09:39发布

我想通过一个Ant构建脚本来做到这一点:

$ /bin/sh
$ cd /path/to/executable
$ ./executable.sh

这是我试过,但我认为这只是执行cd命令:

<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.

Answer 1:

只有后的第一个参数-c是由shell中运行,所以你看到的行为。 只要把两个命令为一个ARG,用分号隔开:

<exec executable="/bin/sh" os="Mac OS X">
    <arg value="-c"/>
    <arg value="cd /path/to/executable; ./executable.sh"/>
</exec>


文章来源: Run multiple commands through Ant exec
标签: ant