Releases: mvdan/sh
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!
v3.5.0
This release drops support for Go 1.16 and includes many new features.
- cmd/shfmt
- Switch to
-ln=autoby default to detect the shell language - Add support for long flags, like
--indentfor-i
- Switch to
- syntax
- Allow extglob wildcards as function names like
@() { ... } - Add support for heredocs surrounded by backquotes
- Add support for backquoted inline comments
- Add
NewPosto createPosvalues externally - Support escaped newlines with CRLF line endings
Minifyno longer omits a leading shebang comment- Avoid printing escaped newlines in non-quoted words
- Fix some printer edge cases where comments weren't properly spaced
- Allow extglob wildcards as function names like
- fileutil
- Add
Shebangto extract the shell language from a#!line
- Add
- expand
- Reimplement globstar
**globbing for correctness - Replace
os.Statas the last direct use of the filesystem
- Reimplement globstar
- interp
- Add
CallHandlerto intercept all interpretedCallExprnodes - Add
ReadDirHandlerto intercept glob expansion filesystem reads - Add
StatHandlerto interceptos.Statandos.Lstatcalls - Always surface exit codes from command substitutions
- Add initial and incomplete support for
set -x - Add support for
cd -ascd "$OLDPWD" - Avoid panic on
set - args
- Add
Binaries built on go version go1.18.2 linux/amd64 via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!
v3.4.3
- cmd/shfmt
- New Docker
v3tag to track the latest stable version - Don't duplicate errors when walking directories
- New Docker
- interp
- Properly handle empty paths in the
testbuiltin - Allow unsetting global vars from inside a function again
- Use
%wto wrap errors inDir
- Properly handle empty paths in the
Binaries built on go version go1.17.7 linux/amd64 via a shell script.
Consider becoming a sponsor if you benefit from the work that went into this release!