shfmt3.12.0

A shell parser, formatter and interpreter (POSIX/Bash/mksh).

LinuxDeveloper ToolsOpen source

Verify your download

Select the file you downloaded to check it against the hash we published — the check runs in your browser, nothing is uploaded.

About

shfmt parses shell source into syntax trees, allowing developers to inspect scripts and rewrite them in a consistent format. It combines that formatter with an interpreter for POSIX Shell, Bash, Zsh, and mksh code. The result addresses the inconsistent layout and difficult static analysis that often arise as shell scripts grow.

The accompanying syntax package supports parsing and examining scripts programmatically, while shell helpers split command lines into arguments, quote them, expand variables and tildes, and handle globbing with double-star patterns or case-style matching. Its interpreter can execute scripts without a system shell, including on Windows, with handlers that define what scripts may run and access. The project documents the formatter’s default style through canonical.sh and provides a man page in Markdown or scdoc-rendered form.

Canonical publishes shfmt as open-source Developer Tools software on Linux, with version 3.12.0 available for x86_64 (amd64); the package requires snapd. Building its pure-Go source requires Go 1.26 or later. It suits developers maintaining POSIX or Bash-family scripts who want repeatable formatting, syntax inspection, or shell execution embedded in development workflows.

The pure-Go interpreter cannot fork its own process, so subshells use goroutines and cannot directly provide real process IDs or file descriptors. Bash associative-array indexes must be quoted for reliable static parsing, and the parser does not support the ambiguity between $(( and ((. It treats export, let, and declare as keywords for static syntax trees, while formatting cannot be disabled for selected ranges of lines.

Requires Linux + snapd · Architecture: x86_64 (amd64)

Details

PlatformLinux
CategoryDeveloper Tools
LicenseOpen source
PricingFree
Package IDshfmt
AuthorCanonical
Latest versionv3.12.0
File typeSNAP
Minimum OSLinux + snapd
Architecturex86_64 (amd64)
File size1.0 MB
Published9/25/2026

SHA-256

Does this still work for you?

Works (0)Doesn't work (0)Sign in to vote

Badge for your website

Developers can show that shfmt is available on MirrorNest. Copy the code below: the badge links to this page and updates itself.

shfmt on MirrorNest
HTML
<a href="https://mirrornest.com/software/shfmt-9b438ca9"><img src="https://mirrornest.com/badge/shfmt-9b438ca9.svg" alt="shfmt on MirrorNest" height="20"></a>
Markdown
[![shfmt on MirrorNest](https://mirrornest.com/badge/shfmt-9b438ca9.svg)](https://mirrornest.com/software/shfmt-9b438ca9)

Reviews

No reviews yet — be the first.

Leave a review

Sign in to post as a verified member instead of anonymously.

shfmt alternatives