sh
agent-ready non-interactive
A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt
How to install sh
go install mvdan.cc/sh/v3/cmd/shfmt@latest sh use case
Formatting, parsing, and interpreting shell scripts (POSIX, Bash, Zsh, mksh) with a focus on standardization and linting.
When to use sh
- When you need to automatically format shell scripts to a consistent style (e.g., shfmt -l -w script.sh).
- When parsing shell scripts to perform static analysis or transform them programmatically using Go libraries.
- When interpreting or running shell scripts in a controlled Go environment (e.g., for testing or sandboxing).
When not to use sh
- When you need to execute shell scripts interactively or with complex user input (use a real shell instead).
- When the task is not related to shell scripting (e.g., formatting Python or JavaScript code).
sh features
- · Shell script formatting (shfmt) with customizable style.
- · Parsing and printing of shell AST (abstract syntax tree) via Go syntax package.
- · Shell expansion and variable substitution via shell package.
- · Interpretation and execution of shell scripts via interp package.
Want your agent to find this automatically?
Add the MCP server to your agent config and it will discover tools like sh on its own.
Set up MCP →