Bash tool uses login shell (-l) causing unwanted output
Status Closed — not planned
Maintainer reply ✓ Yes — wolffiex
Workaround ✓ Mentioned in thread ↓
Activity 12 comments · opened Nov 18, 2025 · closed Jan 27, 2026
💡 Likely answer: A maintainer (wolffiex, collaborator)
responded on this thread — see the highlighted reply below.
Issue
Every bash command is executed as a login shell, sourcing ~/.bash_profile / ~/.profile on each invocation. This pollutes command output with login script messages and adds unnecessary overhead.
Steps to Reproduce
- Add any output statement to
~/.bash_profile(e.g.,echo "Login shell initialized") - Execute any Bash tool command through Claude Code
- Observe the extra output from the login script
Verification
$ shopt login_shell
login_shell on
Expected
Commands should run in non-login shells. The -l flag should not be used unless specifically needed.
Impact
- Extraneous output in command results
- Performance overhead from repeatedly sourcing login scripts
- Unexpected environment modifications
12 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The other issues are not duplicates. #11684 proposes several solutions, only one of which solves this problem.
I have this problem due to .bash_profile including a CD command to a common workspace directory which screws up claude's Bash tool since the working directory gets modified -_-
+1 on making shell invocation configurable. I'd additionally want to be able to set the shell used. I'm using zsh but want claude to run bash. Setting
"SHELL": "/bin/bash"under"env"insettings.jsonappears to be ignored.I added a (secret) env var for this:
CLAUDE_BASH_NO_LOGINCan you try setting this and confirm it's what you want? If it is I will document it at a minimum and consider making it the default
Works for me, thanks.
Unless you can find any reason why the -l flag was added in the first place, I concur with removing it by default.
Tested
CLAUDE_BASH_NO_LOGIN- Works Great!@wolffiex Thank you for implementing this fix! I've tested it thoroughly and it works perfectly.
Test Environment:
Test Results:
After setting
CLAUDE_BASH_NO_LOGIN=1in~/.claude/settings.local.json:✅ Edit Tool: Multiple consecutive Read → Edit operations succeeded
✅ No Errors: "File has been unexpectedly modified" completely resolved
✅ Stable: Works consistently across different file types
Real-World Impact:
This fix also resolves the Edit tool timestamp issue I reported in #11684, confirming that both issues share the same root cause:
bash -lsourcing profile scripts.Feedback:
The fix works excellently! Suggestions for next steps:
Thanks again for the quick turnaround on this!
Thank you for at least the workaround, this solves an issue I have because I include
cd ~in my login profile to make my tmux workflow easier.I'd like to see this become the default -- tools should not be starting "login" shells because login profiles commonly include extra setup that's not necessary or appropriate for every subshell invocation.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
This is a lot late, but this is now the default behavior in Claude Code. Thanks for the feedback!