mvdan/sh

A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 24 minutes ago
Added to GitGenius on September 7th, 2026
Created on January 16th, 2016
Open Issues & Pull Requests: 93 (+0)
GitHub issues: Enabled
Number of forks: 451
Total Stargazers: 9,041 (+1)
Total Subscribers: 61 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 28.6 hours
Mean response time: 31.5 days
90th percentile: 58.3 days
Tracked items: 244

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 86% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 11% of issues opened in the past year have been closed. Three people close 93% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 36
New in 7 days: 0
Closed in 7 days: 7
Avg open age: 686 days
Stale 30+ days: 25
Stale 90+ days: 21

Recent activity

Opened in 7 days: 0
Closed in 7 days: 3
Comments in 7 days: 1
Events in 7 days: 1

Top labels

  • zsh (50)
  • needs info (10)
  • help wanted (6)
  • enhancement (5)
  • bash (3)
  • bug (2)

Detailed Description

sh is a shell parser, formatter, and interpreter written in Go that supports POSIX Shell, Bash, Zsh, and mksh.

The tool addresses the need to programmatically work with shell scripts in Go applications. It provides three main capabilities: parsing shell code into an abstract syntax tree through its syntax package, performing high-level operations like shell expansions through its shell package, and interpreting or executing shell scripts through its interp package. The shfmt command-line tool formats shell programs according to a canonical style, with options to list differences or write changes in place.

Developers should choose this tool when they need to integrate shell script processing into Go applications or want a standalone formatter for shell code. It suits projects that require parsing shell syntax without spawning external processes, or teams seeking consistent shell script formatting. The tool's pure Go implementation means it runs anywhere Go runs without external dependencies, though this design choice limits how closely the interpreter can follow POSIX and Bash semantics in edge cases like process forking and file descriptor handling. The formatter intentionally avoids partial-file formatting and minimizes configuration options to maintain consistency and reduce maintenance burden.

Development activity shows a disciplined approach to scope and quality. The project explicitly discourages drive-by patches from non-active contributors, requesting detailed issues instead. The maintainer has established clear caveats about parser limitations, such as the inability to handle certain ambiguities in Bash syntax without backtracking, and documents these transparently in the README. The project maintains a philosophy against adding formatting flags beyond necessity, acknowledging that each option multiplies complexity across development, testing, and documentation. The tool is packaged across numerous distributions and platforms, indicating sustained maintenance and broad compatibility testing.