LinuxCommandLibrary

shfmt

Shell parser, formatter and interpreter.

TLDR

Print a formatted version of a shell script

$ shfmt [path/to/file]
copy


List unformatted files
$ shfmt --list [path/to/directory]
copy


Write the result to the file instead of printing it to the terminal
$ shfmt --write [path/to/file]
copy


Simplify the code, removing redundant pieces of syntax (i.e. removing "$" from vars in expressions)
$ shfmt --simplify [path/to/file]
copy

Copied to clipboard