Add Comments in Bash Scripts

To make comments in bash scripts, use the # (hash) symbol. Anything on the same line after the hash will not run when the script is executed.


Here is an example of a comment at the top of a bash script:


echo "Hello World!"


You can also add comments after code on a line to narrate it. Here is an example:


echo "Hello World!" # Say hello to the world.