Giter VIP home page Giter VIP logo

universal-bash's Introduction

universal-bash

universal-bash is an npm package that enables the execution of Bash scripts on Windows systems, making it as easy as running them on macOS or Linux. It provides a seamless experience for developers who need to work with Bash scripts across different operating systems.

Please note that currently, universal-bash only supports Windows. However, future updates may include support for other platforms.

Installation

To use universal-bash, simply install it as a dependency in your project by running the following command:

npm install universal-bash

in order to make it availabe anywhere, just install the package with "-g" flag.

npm install -g universal-bash

By default, universal-bash uses Git Bash, a popular bash-compatible shell for Windows, as the underlying interpreter. If the system already has bash, universal-bash will use it for script execution. However, this behavior can be disabled by setting the NOT_USE_GLOBAL_BASH environment variable to 1 during the package installation process.

NOT_USE_GLOBAL_BASH=1 npm install universal-bash

If bash is not available, universal-bash will automatically install git-bash as a local dependency to ensure compatibility.

For example, you can run the following command to install universal-bash and force the installation of a local copy of Git Bash:

Usage

Using universal-bash is straightforward. Once installed, you can execute Bash scripts on your Windows machine using the bash command. The bash command is provided by Git Bash, which is utilized by universal-bash.

Global executable

To run a Bash script, open your command prompt or terminal and use the following command:

bash path/to/your/script.sh

Replace path/to/your/script.sh with the actual path to your Bash script file.

Inside package.json

If you have installed the package as a local dependency, Bash will be available inside npm scripts. You only need to add your command to the package.json file.

{
  "scripts" : {
     "myScript" : "bash path/to/your/script.sh"
  }
}

Then you can run the script with the following command:

npm run myScript

This way, the script will be executable regardless of the operating system when someone clones the project in the future.

Contribution

Contributions to universal-bash are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.

Please ensure that any contributions adhere to the project's coding standards and follow the guidelines outlined in the repository.

License

This project is licensed under the MIT License. For more information, please refer to the LICENSE file.


Thank you for choosing universal-bash! We hope it simplifies your experience with running Bash scripts on Windows. If you find it useful, please consider giving it a star on GitHub. If you have any questions, feel free to reach out to us.

universal-bash's People

Contributors

javadkh2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.