Documenting bash scripts

For those of us still in the bash trenches now and then, I learned you can avoid the hassle of hash/octothorpe (#) commenting blocks of documentation in your scripts by using a standard “here” doc prefixed by the no-op expression (:).

Clearly this is something you’d only want to do for major blocks of text, like a large documentation block at the start of a script.

Example:

: <<'DOCUMENTATION'

My free-form documentation here.

DOCUMENTATION

2 thoughts on “Documenting bash scripts”

Leave a Reply

Your email address will not be published. Required fields are marked *