From: Johannes Sixt Date: Thu, 08 Feb 2007 08:09:14 GMT Subject: Re: MinGW binary installer available Message-ID: <45CADAAA.74058D21@eudaptics.com> In-Reply-To: <45C9EB54.3040406@xs4all.nl> Han-Wen Nienhuys wrote: > Indeed: for now, this is intended for people clueful enough to install > bash and perl on their own. Adding bash itself should be easy, but > I have no idea how to make cmd open the scripts with bash automatically. I've thought about renaming git-commit to git-commit.cmd and add this preamble: @echo off rem () { :; } ; : \ sh %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 rem ; : \ exit /B %ERRORLEVEL% in place of the usual "#!/bin/sh". It requires you to have a command named @echo.exe in the path that is a noop. Also, it is limited to 9 command line arguments. What a hack! (*) -- Hannes (*) Here's how it works: - cmd.exe will ignore all but the sh and exit lines, effectively invoking the script under bash and exiting with bash's exit code. - Bash will execute @echo, define a function named rem, ignore the sh and exit lines because they are continuations of the : noop on the previous line. It will also run the second rem, but it is a noop, too.