shfmt
Shell parser, formatter, and interpreter. tldr-pages
On several platforms
Several platforms
Print a formatted version of a shell script
shfmt path/to/fileIdentifyList unformatted files
shfmt --list path/to/directoryIdentifyWrite the result to the file instead of printing it to the terminal
shfmt --write path/to/fileIdentifySimplify the code, removing redundant pieces of syntax (e.g. removing "$" from vars in expressions)
shfmt --simplify path/to/fileIdentifySpecify the amount of spaces to use for indentation (0 for tabs, which is also the default)
shfmt --indent 4 path/to/fileIdentifyFormat the code according to Google's style guide
shfmt --indent 2 --case-indent --write path/to/fileIdentify