Abusing Bash pretty-printing of parsed functions to format scripts. Who needs reliable tools like shfmt?
Tested on GNU bash version 5.3.9, distributed by Debian 14 "Forky" (bash 5.3-3)
- If the input has syntax errors like a mismatched
}, it'll run part of the input instead of formatting it! - Comments are deleted. Though, I'm considering to somehow track their line-numbers and re-insert them.
- Fails on tab-indented here-docs (
<<-)