[BUG] Bash mode does not execute commands in Bash
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.41 (Claude Code)
- Operating System: macOS 15.5
- Terminal: fish shell with iTem 2
Bug Description
The ! command trigger in Claude Code always uses /bin/zsh for command execution, even though:
- The user's shell is fish (or bash);
- Claude Code was launched from fish (or bash);
!is called "Bash mode" in the shortcuts.
<img width="168" alt="Image" src="https://github.com/user-attachments/assets/d5f3a607-acd8-487c-9835-20c31a2d1490" />
<img width="182" alt="Image" src="https://github.com/user-attachments/assets/09a90df1-9da5-49b3-9021-7cb68a91b45a" />
Steps to Reproduce
- Set fish (or bash) as the default shell:
chsh -s /opt/homebrew/bin/fish - Launch Claude Code from fish (or bash):
claude - Use any
!command, e.g.,!echo $SHELLor!echo $0 - Observe that the output is
/bin/zshand commands are executed in zsh.
<img width="129" alt="Image" src="https://github.com/user-attachments/assets/cf7c6b77-11c1-4e61-bc48-9c077ad4e052" />
p.s. The same occurs with the Bash tool.
<img width="187" alt="Image" src="https://github.com/user-attachments/assets/08ce31ca-9dc2-470d-82fe-e35106b00b1d" />
Expected Behavior
The ! command should execute commands in either Bash as it claims or the shell from which Claude Code was launched.
Actual Behavior
- Commands are always executed using
/bin/zsh - The SHELL environment variable is set to
/bin/zshwithin Claude Code - Shell-specific features and configurations from fish are not available
Additional Context
- As mentioned in https://github.com/anthropics/claude-code/issues/2358, I think we need better documentation for Bash mode behaviors.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗