We can use both the single line and multi lines comment in shell script. For using a single line comment we use # in front of the line and for a multi lines comment we use : ‘ ‘ . Let’s see and example:
#!/usr/bin/env bash #Single line comment echo "hello world!" : 'This is a multi line comment ' echo new world!
Save this as comment_ex.sh and run as like:
$ bash comment_ex.sh Output: hello world! new world!
You can see the commented texts are ignored.
To see list of examples visit GitHub repository: GitHub Link