[BUG] Bash mode does not execute commands in Bash

Resolved 💬 3 comments Opened Jul 3, 2025 by Domon Closed Aug 20, 2025

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:

  1. The user's shell is fish (or bash);
  2. Claude Code was launched from fish (or bash);
  3. ! 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

  1. Set fish (or bash) as the default shell: chsh -s /opt/homebrew/bin/fish
  2. Launch Claude Code from fish (or bash): claude
  3. Use any ! command, e.g., !echo $SHELL or !echo $0
  4. Observe that the output is /bin/zsh and 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/zsh within Claude Code
  • Shell-specific features and configurations from fish are not available

Additional Context

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗