I am having a large shell script file. At times while doing modification I want to comment out part of it. But commenting line as shown in the below example is giving me e
First, using here docs to comment code is really dirty! Use the #
instead. If you want to comment multiple lines, use your editor. In vim (commenting lines from 10 to 15 for example):
:10,15s/^/#
However, to solve your current problem you need to enclose the starting here-doc delimiter in single quotes, like this:
<<'COMMENT'
...
COMMENT
Using single quotes you tell bash that it should not attempt to expand variables or expression inside the here doc body.