← Package directory
Available on winget

Install shfmt

Format shell programs

Install with winget
winget install --id mvdan.shfmt
Upgrade
winget upgrade --id mvdan.shfmt
Uninstall
winget uninstall --id mvdan.shfmt

About shfmt

Format shell programs

What's new in 3.13.1

- cmd/shfmt - Add support for [[zsh]] in EditorConfig files - Detect the shell variant from filenames like .zshrc and .bash_profile - Fix --apply-ignore when used with explicit args - #1310 - syntax - Revert an accidental change to how array subscripts are formatted - #1314 - Never join ;; with the previous line when formatting - #1289 - Fix a bug where $1[foo] was parsed as a subscript in Zsh - #1288 - Correctly parse $! in double quotes in Zsh - #1298 - Allow indexing into special parameters in Zsh - #1299 - Allow parameter expansions with empty names in Zsh - #1280 - interp - Test against Bash 5.3 and fix three new discrepancies - Fix a few bugs related to nameref variables - Avoid panics when user input encounters unimplemented features

Read release notes

Version history

Version Updated Notes
3.13.1 Unknown - cmd/shfmt - Add support for [[zsh]] in EditorConfig files - Detect the shell variant from filenames like .zshrc and .bash_profile - Fix --apply-ignore when used with explicit args - #1310 - syntax - Revert an accidenta...
3.13.0 Unknown Release notes
3.12.0 Unknown - The mvdan-sh JS package is discontinued in favor of sh-syntax - #1145 - cmd/shfmt - Support the "simplify" and "minify" flags via EditorConfig - #819 - Do not allow --write to replace non-regular files - #843 - interp...
3.11.0 Unknown This release drops support for Go 1.22 and includes many enhancements. - cmd/shfmt - Support -l=0 and -f=0 to split filenames with null bytes - #1096 - syntax - New iterator API: Parser.WordsSeq - Fix Parser.Incomplete a...
3.10.0 Unknown - cmd/shfmt - Report the correct language variant in parser error messages - #1102 - Move --filename out of the parser options category - #1079 - syntax - Parse all CRLF line endings as LF, including inside heredocs - #1...
3.9.0 Unknown This release drops support for Go 1.21 and includes many fixes. - cmd/shfmt - Switch the diff implementation to remove one dependency - syntax - Protect against overflows in position offset integers - interp - Use os.Pip...
3.8.0 Unknown This release drops support for Go 1.19 and 1.20 and includes many features and bugfixes, such as improving EditorConfig support in shfmt. - cmd/shfmt - Support EditorConfig language sections such as [[shell]] - #664 - Ad...
3.7.0 Unknown This release drops support for Go 1.18 and includes many features and fixes. - syntax - Correctly parse $foo#bar as a single word - [#1003] - Make &> redirect operators an error in POSIX mode - [#991] - Avoid producing i...
3.6.0 Unknown - Implement --from-json as the reverse of --to-json - #900 - Improve the quality of the --to-json output - #900 - Provide detected language when erroring with -ln=auto - #803