Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run multiple commands through Ant exec

Tags:

ant

I want to do this through an Ant build script:

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

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>

I am on Mac OS X.

like image 302
Ohas Avatar asked Dec 20 '12 10:12

Ohas


1 Answers

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>
like image 82
martin clayton Avatar answered Sep 20 '22 00:09

martin clayton