{"repo":"mvdan/sh","free":true,"listed":false,"github":"https://github.com/mvdan/sh","clone":"git clone https://github.com/mvdan/sh.git","description":"A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt","language":"Go","stars":8986,"topics":["go","parser","shell","bash","formatter","posix","mksh","interpreter","beautify","shfmt"],"license":"BSD-3-Clause","category":"cli-tools","readme_excerpt":"sh A shell parser, formatter, and interpreter. Supports [POSIX Shell], [Bash], [Zsh], and [mksh]. Requires Go 1.26 or later. Quick start To parse shell scripts, inspect them, and print them out, see the syntax package. For high-level operations like performing shell expansions on strings, see the shell package. To interpret or run shell scripts, see the interp package. shfmt go install mvdan.cc/sh/v3/cmd/shfmt@latest shfmt formats shell programs. See canonical.sh for a quick look at its default style. For example: shfmt -l -w script.sh For more information, see its manpage, which can be viewed directly as Markdown or rendered with [scdoc]. Packages are available on [Alpine], [Arch], [Debian], [Docker], [Fedora], [FreeBSD], [Homebrew], [MacPorts], [NixOS], [OpenSUSE], [Scoop], [Snapcraft], [Void] and [webi]. gosh go install mvdan.cc/sh/v3/cmd/gosh@latest Proof of concept shell that uses the interp package. Contributing Bug reports and feature requests should be filed as detailed issues, ideally with an example which reproduces the bug or shows what feature you're after. Unless you're an active user or contributor to the project, drive-by AI patches are not helpful. File detailed issues instead. Fuzzing We use Go's native fuzzing support. For instance: cd syntax go test -run=- -fuzz=ParsePrint Caveats When indexing Bash associative arrays, always use quotes. The static parser will otherwise have to assume that the index is an arithmetic expression. $(( and (( ambiguity is not s","default_branch":null,"files":null,"tree":[],"storefront":"/r/mvdan","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mvdan/sh/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}