mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
6.97k stars 332 forks source link

Multiple commands in one line #1061

Closed mastromberger closed 4 months ago

mastromberger commented 4 months ago

I use in some scripts multiple commands in one line, e.g. variables with initial values. ACTION=0; TOCLIP=0; AMON=""; GEOM=""

shfmt -d suggests following - is there a way to keep multiple commands with a semicolon in one line?

-ACTION=0; TOCLIP=0; AMON=""; GEOM="" +ACTION=0 +TOCLIP=0 +AMON="" +GEOM=""

mvdan commented 4 months ago

Sorry, but that's not planned. See https://github.com/mvdan/sh/issues/679#issuecomment-790539371.

mvdan commented 4 months ago

That said, note that you can always doo FOO=x BAR=y BAZ=z in a single line.