+### shfmt
+
+Shell scripts may formatted to some extent with [shfmt](https://github.com/mvdan/sh). At the time of writing it does not format `if`, `for` or `while` statements in the style used by Geeqie.
+However the following script can be used to achieve that:
+
+```sh
+#!/bin/sh
+
+shfmt -s -p -ci -sr -fn | awk '
+ {if ($0 ~ /; then/)
+ {
+ match($0, /^\t*/);
+ printf('%s\n', substr($0, 0, length($0) - 6));
+ printf('%s, substr("\t\t\t\t\t\t\t\t\t\t", 1, RLENGTH))
+ print("then")
+ }
+ else if ($0 ~ /; do/)
+ {
+ match($0, /^\t*/);
+ printf('%s\n', substr($0, 0, length($0) - 4));
+ printf('%s', substr("\t\t\t\t\t\t\t\t\t\t", 1, RLENGTH))
+ print("do")
+ }
+ else
+ {
+ print
+ }
+ }'
+```
+