Skip to content

A small helper for MSYS2/Cygwin that allows direct execution of shell scripts by Windows applications.

License

Notifications You must be signed in to change notification settings

matveyt/shebang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shebang

Summary

An utility for MSYS2/Cygwin which allows to execute POSIX shell scripts transparently.

Description

MSYS comes with its own port of bash which is able to execute shell scripts. However, unlike ported binaries, no POSIX shell script can be executed directly from the native Windows command-line interpretator cmd (or from other Windows programs, such as FAR, etc.).

It's quite easy to come up with the "wrapper script" solution, for example:

@rem shebang.cmd
@env MSYSTEM=MINGW64 %~n0 %*

will execute any POSIX script (or native binary) called "shebang" found on PATH. However, any (incorrectly ported) application will fail if it tries to execute such script by spawning it directly, which is normal for the POSIX world, but not for Windows, where one needs to provide an explicit command, such as cmd /C shebang.cmd. This is where shebang comes to help.

Building

Shebang was successfully built and tested with GCC/MinGW 14.1.0.

Simply invoke make to compile.

Using

Rename or symlink shebang, so its name matches the script you want and put it on PATH. Now upon execution shebang will find the script on PATH, parse its first (aka "shebang") line, and execute it with own command-line arguments.

About

A small helper for MSYS2/Cygwin that allows direct execution of shell scripts by Windows applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published