about Grigoris Maravelias
Multiple-line comment for shell scripts

Multiple-line comment for shell scripts

How to comment a block of text without inserting the ‘#’ character to all lines?
We just use a ‘<<COMMENT_STRING’ (COMMENT_STRING can be obviously whatever we want) before the line of text we want to comment out and ‘COMMENT_STRING’ after the last line.

An example:

<<HEADER_COMMENT
This is a test comment - lol!
HEADER_COMMENT

[source1,source2]

ps. In source 1 the “:” is placed in front of the “<<COMMENT_STRING”, which is not mentioned in source 2 and from what I tested with bash scripts it seems not necessary.

Leave a Reply

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