A useful way to comment out blocks of code in bash

Bash does not have an 'easy' way to comment out blocks of code - but this is simple enough.

At the beginning of the block you wish to comment out put:

: <<'QWERTY'

and at the end of the block put:

QWERTY

I've used 'QWERTY' as it should be a string of characters which is not used in you code - adjust as needed.

Comments

  • kbailey

    As a Brucie bonus...
    If you are editing using the shell-script(bash) mode in Emacs then Emacs will recognise the commented out block and colour it accordingly.
  • maicon

    thanks!