Single script to run in both Windows batch and Linux Bash?

后端 未结 11 1911
盖世英雄少女心
盖世英雄少女心 2020-11-28 19:04

Is it possible to write a single script file which executes in both Windows (treated as .bat) and Linux (via Bash)?

I know the basic syntax of both, but didn\'t figu

11条回答
  •  心在旅途
    2020-11-28 19:39

    There is a platform independent build tools like Ant or Maven with xml syntax (based on Java). So, you could rewrite all your scripts in Ant or Maven an run them despite os type. Or you could just create Ant wrapper script, which will analyze os type and run appropriate bat or bash script.

提交回复
热议问题