bashy: a pure-Go Bash 5.3 that runs on Windows and rebuilds itself from the downloaded binary
I've been building a Bash 5.3 in pure Go — no CGo, one static binary — on top of mvdan/sh , mostly so the same scripts run on Windows. It passes all 86 runnable fixtures of GNU Bash's own test suite on Linux and macOS. (The Windows run is not yet measured to the same standard — an honest gap; the README lists what is still known-different.) Install A tarball on Linux/macOS, a zip on Windows:…
Bashy is a pure-Go implementation of Bash 5.3 that functions on both Windows and other operating systems. It is built entirely without CGo, and the resulting binary is static. The project leverages mvdan/sh as its foundation, and it aims to ensure that the same scripts will run on Windows as they do on Linux and macOS. Currently, the Windows version has not been tested to the same degree as the other platforms, and this discrepancy is acknowledged in the README.
To install Bashy, users can download a tarball for Linux/macOS or a zip file for Windows from the GitHub releases page: https://github.com/qiangli/bashy/releases/latest. A small tour repository is also available, showcasing 27 scripts and their expected output, which users can compare on their own machines: https://github.com/qiangli/bashsharp-tour.
One of the most appealing aspects of Bashy is that it requires no additional setup on Windows. After downloading the appropriate package, users can simply run bashy to fetch a pinned MinGit, provision their own Go toolchain, and trigger the binary to rebuild itself. This process is illustrated in the following command:
curl.exe -fsSLO https://github.com/qiangli/bashy/releases/latest/download/bashy-windows-amd64.zip
tar.exe -xf bashy-windows-amd64.zip . \bashy
cd bashy ; .. \bashy scripts/bootstrap-siblings.sh ; .. \bashy dag build bin\bashy.exe --version
One potential limitation of Bashy lies in its handling of certain shell features, particularly those involving set -o options, traps, and coproc statements. These are the areas where the majority of bugs have been identified. Any issues related to these features can be reported through the project's issue tracker: https://github.com/qiangli/bashy/issues.
Not all features are supported in the default version of Bashy. An opt-in superset dialect is available through a command-line flag. When this flag is not used, Bashy behaves like a plain Bash shell. This post focuses solely on the standard Bash functionality provided by Bashy. The project is licensed under the BSD-3 license, and it is built upon the mvdan/sh library, a work by Daniel Martí, which is credited and forked within the implementation.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.