Yes. Separate out each part out. You are currently publishing the equivalent of of a compiled binary. Split it up, and use a script to "compile" it back into the mega shell script.
It means that changes to each file can tracked (and audited) individually, you can conditionally compile bits in or out, and most usefully, you can write tests for the individual components.