繁体   English   中英

从(linux)中的ant和(windows上的cygwin)调用bash脚本

[英]Calling bash script from ant in (linux) and (cygwin on windows)

我有一个名为bashScript.shbash脚本。

我需要在windows(cygwin)和unix / linux上的ant脚本中启动bashScript.sh

我该怎么做呢?

我尝试了这个,以及一些其他解决方案,使用环境变量,但没有env.OSTYPE 并使用......

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

...不适用于Windows(cygwin),因为cygwin无法找到\\bin\\bash

谢谢,如果您需要更多信息,请告诉我们。

您可以使用不同的osfamily创建两个exec任务。

像这样:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM