shfmt: Format shell programs

To update or switch versions, run webi shfmt@stable or webi shfmt@beta, etc.


These are the files / directories that are created and/or modified with this install:


Cheat Sheet

shfmt is a shell parser, formatter and interpretter that supports POSIX Shell, Bash and mksh.

Usage: shfmt <flags> <filepath>

Note: If given path is directory, all shell scripts in the directory will be used.

Frequently used flags:

    Show version and exit.

    List files whose formatting differs from shfmt's.

    Write result to file instead of stdout.

    Error with a diff when the formatting differs.

    Simplify the code.

    Recursively find all shell files and print the paths.


To list files being formatted and write directly to file

shfmt -l -w <filepath>

To show differences between shfmt formatting and original file formatting

shfmt -d <filepath>

See for more info.


Report an Issue Submit Installer Star on GitHub