Created
November 8, 2011 12:05
-
-
Save ainformatico/1347598 to your computer and use it in GitHub Desktop.
Executing Cygwin Bash scripts on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Execute a bash script with the same filename, source: bit.ly/ef7iQw | |
@echo off | |
setlocal | |
if not exist "%~dpn0.sh" echo Script "%~dpn0.sh" not found & exit 2 | |
set _CYGBIN=C:\cygwin\bin | |
if not exist "%_CYGBIN%" echo Couldn't find Cygwin at "%_CYGBIN%" & exit 3 | |
:: Resolve ___.sh to /cygdrive based *nix path and store in %_CYGSCRIPT% | |
for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%~dpn0.sh"') do set _CYGSCRIPT=%%A | |
:: Throw away temporary env vars and invoke script, passing any args that were passed to us | |
endlocal & %_CYGBIN%\bash --login "%_CYGSCRIPT%" %* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Hello world!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment