[Bug] Lines with the word "for" get filtered out from pipes in Bash tool?
Bug Description
Running !echo 'for test' | grep t returns NO CONTENT!
Agent running Bash(echo 'for test' | grep t) also gets NO CONTENT!
This is not academic, I found this when the agent was searching over a git diff and failing to locate a thing that was there.
It seems to affect all piped content, regardless of programs (echo, printf, git; grep, awk, perl, cat, xargs, etc. etc. etc.)
Please see:
! echo 'for test'
⎿ for test
! echo 'for test' | grep t
⎿ (No content)
! echo 'or test' | grep t
⎿ or test
❯ Please run with Bash tool:
* `echo 'for test' | grep t`
* `echo 'or test' | grep t`
I expect one to fail wrongly, don't go investigating.
∴ Thinking…
The user wants me to run two bash commands to demonstrate something. They expect one to fail incorrectly and don't want me to investigate why.
⏺ Bash(echo 'for test' | grep t)
⎿ No matches found
⏺ Bash(echo 'or test' | grep t)
⎿ or test
∴ Thinking…
(SNIP)
⏺ As you expected, the first command produced no output while the second correctly returned "or test". Both strings contain 't', so the first one failed incorrectly.
Seems to be a pipe-related issue, same with cat:
! echo 'for test' | cat
⎿ (No content)
! echo 'or test' | cat
⎿ or test
Seems to need a space after for and a some non-alphanum char before:
! printf ' for f' | cat
⎿ (No content)
! printf ':for f' | cat
⎿ (No content)
! printf '.for f' | cat
⎿ (No content)
! printf '\tfor f' | cat
⎿ for f
! printf '\nfor f' | cat
⎿ for f
! printf 'for f' | cat
⎿ (No content)
! printf 'for' | cat
⎿ for
Tested without any settings (empty dir in drive root, claude --setting-sources "").
Seen on macOS, and on Ubuntu in Docker, with and without a repo.
❯ /doctor
Diagnostics
└ Currently running: npm-global (2.1.7)
└ Path: /Users/fran/.nvm/versions/node/v18.19.0/bin/node
└ Invoked: /Users/fran/.nvm/versions/node/v18.19.0/bin/claude
└ Config install method: global
└ Search: OK (vendor)
Updates
└ Auto-updates: enabled
└ Update permissions: Yes
└ Auto-update channel: latest
└ Stable version: 2.1.2
└ Latest version: 2.1.7
Environment Info
- Platform: darwin
- Terminal: pycharm
- Version: 2.1.7
- Feedback ID: a3121a95-9539-4f7b-ae45-58b57028ec6b
Errors
[]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗