Recently I got to know about how to comment multiple lines in shell/bash scripts.
I will show an example to comment multiple lines of code in bash/shell script.
Following are lines of code in my script test.sh
The out put we can get after executing script test.sh is shown below:
If we want to print only a and f, we need to comment multiple lines of code in script test.sh. Traditionally we use “#” to comment a single line of code in shell/bash.
To comment multiple lines code you need to add <<COMMENT and COMMENT tags. The code between this to tags will be commented.
The code in test.sh after adding comment tags will looks like below.
Now execute the script test.sh and the output you will get output as shown below: