Last updated 8 months ago
We can format our shell scripts by using
$ docker run --rm -v $PWD:/mnt -w /mnt mvdan/shfmt {ARGS...}
Example
$ 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
shfmt
Reference(s)