Bash - Comment

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

3 - Syntax

# A comment
command # comment

Multiline

echo CommandName InputFiles `#1st comment` \
             --option1 arg1 `#2nd comment` \
             --option2 arg2 `#3rd comment`
Advertising

4 - Configuration

4.1 - interactive_comments

In a non-interactive shell, or an interactive shell in which the interactive_comments option to the shopt builtin is enable, a word beginning with # causes that word and all remaining characters on that line to be ignored.

An interactive shell without the interactive_comments option enabled does not allow comments. The interactive_comments option is on by default in interac- tive shells.