简体   繁体   English

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

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

I have a bash script called bashScript.sh . 我有一个名为bashScript.shbash脚本。

I need to start bashScript.sh inside an ant script on windows(cygwin) and unix/linux. 我需要在windows(cygwin)和unix / linux上的ant脚本中启动bashScript.sh

How do i do this? 我该怎么做呢?

I have tried this, and a few other solutions, using the environment variable but there is no env.OSTYPE . 我尝试了这个,以及一些其他解决方案,使用环境变量,但没有env.OSTYPE And using... 并使用......

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

...does not work on windows(cygwin), because cygwin fails to find \\bin\\bash . ...不适用于Windows(cygwin),因为cygwin无法找到\\bin\\bash

Thanks, if you need more information let me know. 谢谢,如果您需要更多信息,请告诉我们。

You can create two exec tasks with different osfamily s. 您可以使用不同的osfamily创建两个exec任务。

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>

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

相关问题 从 Cygwin bash 脚本执行 Windows 命令 - Execute Windows command from Cygwin bash script 无法在Windows Cygwin中执行bash脚本 - Unable to execute bash script in windows cygwin Run a shell script using Cygwin bash instead of Git Bash for Windows from Eclipse - Run a shell script using Cygwin bash instead of Git Bash for Windows from Eclipse 定义在Windows和Linux(Windows bash或Cygwin)上均可使用的通用别名? - define common alias working on both Windows and Linux(Windows bash or Cygwin)? 在Windows中使用cygwin将长文件参数从批处理脚本传递到bash脚本 - pass long file argument from batch script to bash script in windows with cygwin 来自Windows Cmd的Cygwin Bash未运行可执行文件 - Cygwin Bash from Windows Cmd Not Running Executable 将 windows 路径复制到基于 linux 的终端:Conemu、Cygwin、Git Z7024FF0860DEC6AB1779C7A - Copy windows path into linux based terminals: Conemu, Cygwin, Git Bash 在Windows 10上使用cygwin和git bash的Shell脚本评估失败 - Shell script evaluation failing on windows 10 using cygwin and git bash 在Windows中以编程方式创建Shell脚本,然后通过cygwin在Linux系统上运行它? - Creating a shell script programmatically in Windows and running it on a Linux system via cygwin? 从Windows机器到Linux的Ant自动化 - Ant automation from windows machine to linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM