[BUG] Bash tool generates invalid awk commands with backslash-escaped exclamation marks
Resolved 💬 2 comments Opened Feb 11, 2026 by tsukasaI Closed Feb 13, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code generates awk commands with incorrectly escaped exclamation marks (\!), causing awk syntax errors. The ! negation operator in awk does not need backslash escaping, and doing so produces backslash not last character on line errors.
What Should Happen?
The ! operator in awk should not be backslash-escaped. The correct command would use ! directly:
awk '/^diff --git a\/openapi-/,/^diff --git/ { if (/^diff --git/ && !/^diff --git a\/openapi-/) exit; print }'
Error Messages/Logs
⏺ Bash(gh pr diff 432 | awk '/^diff --git a\/backend\/internal\//,/^diff --git/ { if (/^diff --git/ && !/^diff --git a\/backend\/internal\//) { if (!printed_stop) { pr…)
⎿ Error: Sibling tool call errored
⏺ Bash(gh pr diff 432 | awk 'BEGIN{p=0} /^diff --git a\/web-management\/src\/(components|routes)\//{ p=1 } /^diff --git/ && !/^diff --git a\/web-management\/src\/(comp…)
⎿ Error: Sibling tool call errored
⏺ Bash(gh pr diff 432 | awk 'BEGIN{p=0} /^diff --git a\/web-public\/app\/((\[locale\]|components|actions|fighter))/{ p=1 } /^diff --git/ && !/^diff --git a\/web-public…)
⎿ Error: Sibling tool call errored
All sibling parallel tool calls also failed as a result.
Steps to Reproduce
- Ask Claude Code to review (with /review command) a PR diff filtered by file paths (e.g.,
gh pr diff <number>piped throughawk) - Claude generates parallel awk commands to filter different sections of the diff
- The generated awk patterns use
\!instead of!for negation
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
I use Ghostty for terminal with zsh
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗