Running a shell script through Cygwin on Windows

后端 未结 6 1931
有刺的猬
有刺的猬 2020-12-07 18:14

I have a bunch of shell scripts that used to run on a Linux machine. Now, we\'ve switched over to Windows, and I need to run these scripts there. I have Cygwin installed, bu

6条回答
  •  情话喂你
    2020-12-07 18:54

    The existing answers all seem to run this script in a DOS console window.

    This may be acceptable, but for example means that colour codes (changing text colour) don't work but instead get printed out as they are:

    there is no item "[032mGroovy[0m"

    I found this solution some time ago, so I'm not sure whether mintty.exe is a standard Cygwin utility or whether you have to run the setup program to get it, but I run like this:

    D:\apps\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico  bash.exe .\myShellScript.sh
    

    ... this causes the script to run in a Cygwin BASH console instead of a Windows DOS console.

提交回复
热议问题