A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt
sh is a shell parser, formatter, and interpreter written in Go that supports POSIX Shell, Bash, Zsh, and mksh. The project includes shfmt, a command-line tool for formatting shell scripts with a canonical style, as well as gosh, a proof-of-concept shell implementation. The library provides multiple packages for different use cases: the syntax package for parsing and inspecting shell scripts, the shell package for high-level operations like expansions, and the interp package for interpreting or running shell scripts. The parser and formatter are also available as a third-party npm package called sh-syntax, which bundles the library compiled to WebAssembly.