What
Claude Code picks a shell (bash or zsh) to run commands in. How it picks, and what it tells Claude, has changed:
- It builds a list of candidates, starting with
CLAUDE_CODE_SHELLandSHELL, but only when their value contains bash or zsh. - It then tries zsh and bash in
/bin,/usr/bin,/usr/local/binand/opt/homebrew/bin, and puts bash first whenSHELLis bash. - The
CLAUDE_CODE_SHELLoverride is no longer tried first on its own. It is accepted only when it equals the detected shell. Otherwise a log message says it is not a valid bash/zsh path and detection is used instead. - The environment details given to Claude now name the detected shell. When
SHELLdiffers from it, they read<shell> (login shell: <SHELL shell>). Before, a fixed fallback was returned.
Why
The shell affects every command Claude runs. If you set CLAUDE_CODE_SHELL, make sure it points to a real bash or zsh path, or it will be ignored. Claude may now be told about two shells.
Names in the bundleSHELL
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed since
Anthropic's documentation has since written up SHELL, on Claude Code changelog.
* Fixed bash scripts started from the Bash tool stopping after their first command when `SHELLOPTS` is exportedchangelog see the edit
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agrees
Anthropic's documentation has since written up SHELL, on Claude Code changelog.