In this tutorial I will show you, how to insert comments in shell scripts.
In shell scripting, # is used for inserting comments.
Every line beginning with # (except the shebang #!) will not be executed!
# this is a commented line!
Comments can also occur following the end of a command.
echo "hello" # this display "hello" in your terminal
Note: When you edit configuration files, comment the lines you need to delete. This way, it will be much easier to go back to the previous setting, when you need to.
A commented line starts with # and terminates at the ending of the line. There is no method (character) for terminating a comment. So, A command may not follow a comment on the same line.
Of cource, the # will be ignored if is it quoted or escaped.
$ echo "The # does not begin art a comment here."
The # does not begin a comment here.
$ echo The /# does not begin a comment here.
The /# does not begin a comment here.
The standard quoting and escape characters (” ‘ \) escape the #.