Skip to content

Pin Bash tool shell to zsh so the prompt matches reality#13

Merged
technicalpickles merged 2 commits into
mainfrom
claude-pin-bash-shell-zsh
Jun 17, 2026
Merged

Pin Bash tool shell to zsh so the prompt matches reality#13
technicalpickles merged 2 commits into
mainfrom
claude-pin-bash-shell-zsh

Conversation

@technicalpickles

Copy link
Copy Markdown
Owner

Summary

Our login shell is fish, but Claude Code's Bash tool can't run fish. It only runs bash or zsh, and when $SHELL is neither it silently falls back to /bin/zsh. The catch: the system prompt's Shell: line just echoes raw $SHELL, so Claude gets told "fish" while every command actually runs in zsh. Then it blames fish for zsh behavior it never caused (the classic being ! history expansion, which fish doesn't even do).

Setting SHELL=/bin/zsh in base.jsonc makes that prompt line tell the truth. Execution doesn't change, it was already zsh. This just stops Claude from being lied to.

ADR 0037 has the full reverse-engineering: both the prompt builder and the Bash tool's shell resolver read process.env.SHELL and do opposite things with it. Upstream tracks the same gap in anthropics/claude-code#68349.

Verify

On the next fresh session (the env block applies at session init, not mid-session), the environment block's Shell: line reads zsh instead of /opt/homebrew/bin/fish.

technicalpickles and others added 2 commits June 17, 2026 10:53
Our login shell is fish, but Claude Code's Bash tool only runs bash or zsh
and silently falls back to /bin/zsh. The system prompt's "Shell:" line
reports raw $SHELL (fish), so Claude is told fish while commands actually run
in zsh, then misattributes zsh behavior (\! history expansion, quoting) to a
shell that never ran the command.

Set SHELL=/bin/zsh in base.jsonc so the prompt reports zsh, matching the
shell already in use. Execution is unchanged; this only corrects what Claude
is told. Adds ADR 0037 with the full reverse-engineering.

Refs: anthropics/claude-code#68349

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@technicalpickles technicalpickles merged commit fb994f2 into main Jun 17, 2026
1 check passed
@technicalpickles technicalpickles deleted the claude-pin-bash-shell-zsh branch June 17, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant