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

Filed under Programming, Sysadmin, UNIX/Linux