Can anyone suggest how to comment particular lines in the shell script other than #
?
Suppose I want to comment five lines. Instead of adding #
to each line, is there any other way to comment the five lines?
You can comment section of a script using a conditional.
For example, the following script:
DEBUG=false
if ${DEBUG}; then
echo 1
echo 2
echo 3
echo 4
echo 5
fi
echo 6
echo 7
would output:
6
7
In order to uncomment the section of the code, you simply need to comment the variable:
#DEBUG=false
(Doing so would print the numbers 1 through 7.)