Skip to content

Rudxain/self-bash-fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

self-contained hacky Bash formatter

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)

Caveats

  • 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 (<<-)

Contributors

Languages