Friday, December 7, 2007

Shell script put multiple line comment

Q. I'd like to use multiline comments under shell script. Under C / C++ I can use format
/*
my c code
comment # 2
blah
*/

How do I put multi line comment under a shell script?
A. By default shell script can be commented out prefixing # character for example:
# my comment
For multilinecomment use
# my comment 1
# my comment 2
# my comment N


#!/bin/bash
echo "Say Something"
<<COMMENT1
your comment 1
comment 2
blah
COMMENT1
echo "Do something else"

No comments: