Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to create multiline comments in Bash?

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?

like image 227
Enes Malik Turhan Avatar asked Apr 01 '17 14:04

Enes Malik Turhan


People also ask

How do I make multiline comments?

You can comment multiple lines just by placing them between /* and */.

How do I comment out a line in bash?

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.

How do you comment a line in a shell script?

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.


1 Answers

Use : ' to open and ' to close.

For example:

: ' This is a very neat comment in bash ' 
like image 84
Vegas Avatar answered Sep 17 '22 17:09

Vegas