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
Traditional UNIX shell doesn't have multiline comment support. What you're doing here is using a so-called "HERE document" without using its value, a common hack to get multiline comment like behaviour.
However, patterns inside the the HERE document are still evaluated, which means that your $(…)
is executed. But since build_branch_tag
has not been defined before, it will evaluate to an empty string, and the shell will thus execute sed s///g
.
You can use a different hack:
: '
Bla bla, no $expansion is taking place here.
'
What this is doing: the :
is a no-op command, it simply does nothing. And you're passing it an argument which is a string '…'
. Inside the single quotes, no expansion/evaluation is taking place. Beware of '
inside the "commented out" region, though.