Fixes Claude Code's bash command mangling (affects macOS, Linux, and WSL).
Claude Code mangles bash commands before execution:
$(cmd)becomes\$ ( cmd )- Spurious
< /dev/nullinserted before pipes
This breaks subshell commands like echo $(git rev-parse HEAD).
Related issues:
- #15599 -
$()mangled to\$ ( )and< /dev/nullinjected with pipes - #7387 - Shell script fails due to escaping (
$(find ...)→\$ ( find ...) - #3839 -
< /dev/nullinserted inside single-quoted arguments
A wrapper script that intercepts shell calls and fixes the mangling before passing to real bash.
./install.sh # Install to ~/bin
./install.sh /usr/local/bin # Or specify pathAdd to your shell profile:
export CLAUDE_CODE_SHELL="$HOME/bin/claude-bash-fix"Restart Claude Code.
bats tests/wrapper.batsDEBUG_CLAUDE_BASH=1 claude # See wrapper debug outputThe actual Claude Code implementation is closed-source (in Anthropic's private claude-cli-internal repo). The public github.com/anthropics/claude-code repo only contains plugins and documentation. Report bugs via /bug in Claude Code.