Bash tool parser rejects same-line inline comments on redirect commands
Bash tool parser rejects same-line inline comments on redirect commands
Phenomenon
On the Bash tool surface, appending a same-line inline comment to a command line that contains a redirect is rejected by the host parser; the comment must be moved to its own next line to pass.
Reproduction
- Same-line form:
cat > f <<EOF … EOF # note→ parser rejects. - Next-line form: the same command with
# noteon its own following line → passes.
Environment: Claude Code 2.1.283, macOS.
Evidence
Hook/automation ecosystems commonly carry machine-readable markers in same-line comments — in our repo, a write-guard hook recognizes exemption markers of the form # <marker>(op-id):reason placed at end-of-command or on the next line; the same-line-after-heredoc placement being rejected forced marker placement onto its own line and is documented in our guard's deny message.
Proposal
Document this parser limitation (or tolerate same-line inline comments after redirects/heredocs) — machine-readable same-line comment markers are a widespread pattern in hook and automation tooling, and silent rejection raises integration cost.