> 17k lines of shell script
those two phrases don't belong together... to think about this, "17k lines" and "shell script" should not be used together either.
Also, you are a bit light on tests.. there only seems to be a single trivial one, which seems way too low for a codebase this size.