[BUG] The Bash tool invokes a login shell on linux
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
This sources .profile (or .bash_profile) which is not meant to be sourced for non-interactive shells (this is a one time initialization). If .profile contains some actual session initialization (starting another shell, X, wayland, or whatever really) the bash tool will not work for claude. To my best understanding login shells are not supposed to be used like this.
What Should Happen?
The bash tool should use a non-interactive shell (no "-l").
Error Messages/Logs
Steps to Reproduce
A way to reproduce this is to put something like exec /bin/sh or exec /usr/bin/fish as the last line in .profile. The errors one gets depend on the linux set up a bit. On some machines I have seen claude reporting no output from bash tool, on some others the output is "error: Unable to read input file: Is a directory" and no actual stdout output.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.31
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
I have seen the problem both on Arch and on Ubuntu. This is unrelated to the terminal one is using.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗