Releases: mvdan/sh
v3.13.1
- cmd/shfmt
- Add support for
[[zsh]]in EditorConfig files - Detect the shell variant from filenames like
.zshrcand.bash_profile - Fix
--apply-ignorewhen used with explicit args - #1310
- Add support for
- 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
namerefvariables - Avoid panics when user input encounters unimplemented features
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.26.1 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"
v3.13.0
This release introduces support for Zsh in the parser and formatter, which was tracked in issue #120 alongside the label zsh . While support is not complete, it should be far enough for many use cases.
This release also drops support for Go 1.24 and includes many other enhancements:
- cmd/shfmt
- Exit with a non-zero status when
-lprints any filenames shfmt -versionis now derived from the git current tag, dropping the-ldflagsworkaround
- Exit with a non-zero status when
- syntax
- New nodes types and node fields are introduced alongside
LangZsh LangVariantis now a bitset, allowing the use of sets like "Bash-like"- Add
InteractiveSeqandStmtsSeqiterator methods forParser - Stop exposing the internal buffer in
Printervia struct embedding - Support the use of brace expansions like
declare {a,b}_c=value - Fix a bug where POSIX and Bash incorrectly allowed empty command lists
- New nodes types and node fields are introduced alongside
- interp
- Add support for
shopt -s dotglobandshopt -s extglob - Add support for simple uses of
!(expr)extended glob patterns - Support more builtin flags for
declare,type,read - Fix various bugs relating to nulls, errors, and arrays
- Add support for
- expand
- Add
Config.DotGlobandConfig.ExtGlobfor the interpreter - Add
Variable.Flagsto get the one-characterdeclareflags - Do not force env vars on Windows to be uppercase
- Fix various bugs relating to glob pattern matching
- Add
- pattern
- Add
GlobLeadingDotandExtendedOperatorsfor the interpreter - Add
NegExtGlobErrorto mark the use of!(expr)negation patterns
- Add
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.26.1 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s"
Note that this release no longer includes a sha256sums.txt asset; GitHub now provide digests natively.
v3.12.0
- The
mvdan-shJS package is discontinued in favor ofsh-syntax- #1145 - cmd/shfmt
- interp
- Add
IsBuiltinto check if a command name is a shell built-in - #1164 - Add
HandlerContext.Builtinto allowExecHandlerFuncto call built-ins - Initial support for
$!andwait PID- #221 - Return non-fatal
ExecHandlerFuncerrors via theRunner.RunAPI - Add
HandlerContext.Posto provide handlers with source positions - Deprecate
NewExitStatusandIsExitStatusin favor ofExitStatus - Fix
waitto always return the status of the last given job - Copy all env vars for background subshells to avoid data races
- Support reading random numbers via
$RANDOMand$SRANDOM - Set
$BASH_REMATCHwhen matching regular expressions via=~ - Support modifying local vars from the parent calling function
- Add
- expand
- Adjust which backslash sequences are expanded in here-docs - #1138
- Tweak tilde expansions to match Bash semantics
- pattern
- Remove the flawed and broken
Bracesmode; usesyntax.SplitBracesinstead - Tweak
**to only act as "globstar" when alone as a path element - #1149 - Tweak
*and**to not match leading dots in basenames - Add a
NoGlobStarmode to match the POSIX semantics
- Remove the flawed and broken
- fileutil
- Treat all non-regular files as definitely not shell scripts - #1089
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.24.4 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.12.0"
v3.11.0
This release drops support for Go 1.22 and includes many enhancements.
- cmd/shfmt
- Support
-l=0and-f=0to split filenames with null bytes - #1096
- Support
- syntax
- New iterator API:
Parser.WordsSeq - Fix
Parser.IncompleteandIsIncompleteto work well withParser.Words- #937 - Initial support for parsing incomplete shell via
RecoverErrors - Expand
LangErrorto include which language was used when parsing
- New iterator API:
- interp
- Refactor setting variables to fix array declaration edge cases - #1108
- Fix
testread/write/exec operators to work correctly on directories - #1116 - Replace the
cancelreaderdependency withos.File.SetReadDeadline - Avoid waiting for process substitutions, matching Bash
- Skip
OpenHandlerwhen opening named pipes for process substitutions - #1120 - Use
TMPDIRif set viaEnvto create temporary files such as named pipes
- expand
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.24.0 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.11.0"
v3.10.0
- cmd/shfmt
- syntax
- interp
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.23.2 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.10.0"
v3.9.0
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.Pipefor stdin to prevent draining by subprocesses - #1085 - Support cancelling reads in builtins when stdin is a file - #1066
- Support the
nocaseglobbash option - #1073 - Support the Bash 5.2
@kparameter expansion operator - Support the
test -Oandtest -Goperators on non-Windows - #1080 - Support the
read -sbuiltin flag - #1063
- Use
- expand
A special thanks to @theclapp for their contributors to this release!
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.23.0 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.9.0"
v3.8.0
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
- syntax
- interp
- expand
- Add support for
fs.DirEntryviaReadDir2 - Support zero-padding in brace expansions - #1042
- Add support for
A special thanks to all the contributors to this release! @theclapp @slabstone @MaienM
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.22.0 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.8.0"
v3.7.0
This release drops support for Go 1.18 and includes many features and fixes.
- syntax
- interp
- Add
ExecHandlersto support layering multiple middlewares - #964 - Add initial support for the
selectclause - #969 - Support combining the
errexitandpipefailoptions - #870 - Set
EUIDjust likeUID- #958 - Replace panics on unimplemented builtins with errors - #999
- Tweak build tags to support building for
js/wasm- #983
- Add
- syntax/typedjson
- Avoid
reflect.Value.MethodByNameto reduce binary sizes - #961
- Avoid
A special thanks to all the contributors to this release! @riacataquian @anderbubble @teefill @diamondburned
Consider becoming a sponsor if you benefit from the work that went into this release!
Binaries built on go version go1.20.5 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.7.0"
v3.6.0
This release drops support for Go 1.17 and includes many features and fixes.
- cmd/shfmt
- syntax
- Don't require peeking two bytes after
echo *- #835 - Simplify
${name:-}to the equivalent${name-}- #849 - Don't print trailing whitespaces on nested subshells - #814
- Don't print extra newlines in some case clauses - #779
- Don't indent comments preceding case clause items - #917
- Allow escaped newlines before unquoted words again - #873
- Parse a redirections edge case without spaces - #879
- Give a helpful error when
<<<is used in POSIX mode - #881 - Forbid
${!foo*}and${!foo@}in mksh mode - #929 - Batch allocations less aggressively in the parser
- Don't require peeking two bytes after
- syntax/typedjson
- Expose
--from-jsonand--to-jsonas Go APIs - #885
- Expose
- expand
- interp
- pattern
- Add
EntireStringto match the entire string using^$- #866
- Add
A special thanks to all the contributors to this release!
@fauust @graf0 @hristiy4n @ihar-orca @lollipopman @mkhl @przmv @reubeno @riacataquian @scop @tmillr
Binaries built on go version go1.19.4 linux/amd64 with:
CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X=main.version=v3.6.0"
Consider becoming a sponsor if you benefit from the work that went into this release!
v3.5.1
This release was tagged two weeks ago; we forgot to do the GitHub release with prebuilt binaries.
- cmd/shfmt
- Fix the Docker publishing script bug which broke 3.5.0 - #860
- interp
- pattern
Regexpnow returns the typed errorSyntaxError- #862
Binaries built on go version go1.18.3 linux/amd64 via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!