In a non-interactive shell, or an interactive shell in which the
interactive_comments option to the shopt
builtin is enabled (see The Shopt Builtin),
a word beginning with ‘#’ introduces a comment.
A word begins at the beginning of a line, after unquoted whitespace, or
after an operator.
The comment 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 enabled by default in interactive shells.
See Interactive Shells, for a description of what makes
a shell interactive.