Running .sh scripts in Git Bash

后端 未结 8 2229
无人共我
无人共我 2021-01-31 01:29

I\'m on a Windows machine using Git 2.7.2.windows.1 with MinGW 64.

I have a script in C:/path/to/scripts/myScript.sh.

How do I execute this script f

8条回答
  •  萌比男神i
    2021-01-31 01:57

    Let's say you have a script script.sh. To run it (using Git Bash), you do the following: [a] Add a "sh-bang" line on the first line (e.g. #!/bin/bash) and then [b]:

    # Use ./ (or any valid dir spec):
    ./script.sh
    

    Note: chmod +x does nothing to a script's executability on Git Bash. It won't hurt to run it, but it won't accomplish anything either.

提交回复
热议问题