[BUG] Sandbox incorrectly escapes the '!' character when present in a Bash tool call
Resolved 💬 3 comments Opened Mar 27, 2026 by JohnnyMorganz Closed Mar 31, 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?
Certain bash tool calls might have a ! present in them, e.g. with Maven you can ignore certain modules with !.
However, the sandbox will escape the ! regardless of where it is in the call, even if it is within a string
mvn clean install -DskipTests -T1C -pl '!python'
What Should Happen?
The ! character should not be escaped when it is inside of a string
Error Messages/Logs
Steps to Reproduce
Run Claude Code within a sandbox (/sandbox), and then ask Claude to execute a bash command with a ! within a string.
echo "hello!"
this outputs, incorrectly
hello\!
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.85
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗