Invoking a bash script from ant on (linux) and (cygwin on windows)

I have a bash script called bashScript.sh .

I need to run bashScript.sh inside an ant script on windows (cygwin) and unix / linux.

How can I do it?

I tried this and several other solutions using an environment variable, but there is no env.OSTYPE . And using ...

  <exec executable="/bin/bash" failonerror="true"> <arg value="bashScript.sh"/> </exec> 

... does not work on windows (cygwin) because cygwin does not find \bin\bash .

Thank you if you need more information let me know.

+4
source share
1 answer

You can create two exec tasks with different osfamily s.

Like this:

 <exec dir="." executable="C:\Path\to\cygwin\bin\bash" osfamily="windows"> <arg value="bashScript.sh"/> </exec> <exec dir="." executable="/bin/bash" osfamily="unix"> <arg value="bashScript.sh"/> </exec> 
+13
source

Source: https://habr.com/ru/post/1436862/


All Articles