I have recently started studying shell script and I'd like to be able to comment out a set of lines in a shell script. I mean like it is in case of C/Java :
/* comment1 comment2 comment3 */`
How could I do that?
You can comment multiple lines just by placing them between /* and */.
Bash comments can only be done as single-line comment using the hash character # . Every line or word starting by the # sign cause all the following content to be ignored by the bash shell. This is the only way to do a bash comment and ensure text or code is absolutely not evaluated in Bash.
A single-line comment starts with hashtag symbol with no white spaces (#) and lasts till the end of the line. If the comment exceeds one line then put a hashtag on the next line and continue the comment. The shell script is commented out prefixing # character for single-line comment.
Use : '
to open and '
to close.
For example:
: ' This is a very neat comment in bash '
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With