- Single-Line Comments: Start with the
#
symbol.
#!/bin/bash
# This is a single-line comment
echo "Hello, World!"
- Multi-Line Comments: write multiline comments ****by enclosing the comments between <<COMMENT and COMMENT.
#!/bin/bash
<< COMMENTS
This is a
multi-line comment
COMMENTS
echo "Hello, World!"
- Inline Comments: Comments can be placed after a command on the same line.
#!/bin/bash
echo "Hello, World!" # This prints a greeting