shopt-option
Bash shopt interactive_comments
Allows comments beginning with an unquoted # at a word boundary in interactive shells. Noninteractive shells recognize comments regardless. Also exposed as set -o interactive-comments. This fixture verifies both option interfaces, not interactive parsing. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): enabled; disabled.
Formal Syntax & Structure
bash syntaxbash
shopt -s interactive_comments; shopt -u interactive_comments; shopt -q interactive_commentsReturn Value
exit status
Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.
Working Example
Example Snippetbash
set -o interactive-commentsshopt -q interactive_comments || exit 1printf 'enabled\n'shopt -u interactive_comments[[ ! -o interactive-comments ]] || exit 1printf 'disabled\n'