Skip to content

bash/shfmt

Checks that every shell script matches the shfmt output.

Part of the bash configuration, at the recommended level. It runs at the commit stage, per file. It runs shfmt. gspot check --fix fixes what it can.

One formatter means diffs show what changed, not how someone’s editor indents.

Run gspot check --fix to format every script, or shfmt -w on one file.

if true;then echo hello;fi differs from the shfmt output. Run gspot check --fix to add the spacing and line breaks.

Turn it off for some files, or one of its lint rules, with a reason:

gspot ignore bash/shfmt --paths "<glob>" --reason "<why>"
gspot ignore bash/shfmt --rule <rule> --reason "<why>"