> For the complete documentation index, see [llms.txt](https://til.devjugal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.devjugal.com/linux/bash/shell-formatter.md).

# shell-formatter

## Shell Formatter

We can format our shell scripts by using [`shfmt`](https://github.com/mvdan/sh)

## Usage

```bash
docker run --rm -v $PWD:/mnt -w /mnt mvdan/shfmt {ARGS...}
```

**Example**

```bash
docker run --rm -v $PWD:/mnt -w /mnt mvdan/shfmt -w .
```

This will run `shfmt` and write changes to all the files in current directory

**Reference(s)**

* [shfmt on GitHub](https://github.com/mvdan/sh)
