[BUG] bash mode doesn't understand chained commands

Resolved 💬 4 comments Opened Mar 7, 2025 by peterkaminski Closed May 7, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.32 (Claude Code)
  • Operating System: macOS Sonoma 14.7 (M1 Max)
  • Terminal: iTerm2

Bug Description

bash mode with the command cd (dirpath) && (other_command) assumes that everything after the cd is a dirpath.

Or said another way, the parser doesn't know about logical AND in command lines.

Steps to Reproduce

  1. in the Claude Code input box, enter cd (dirpath) && (other_command). For instance, cd ../.. && yarn clean.

Expected Behavior

For the cd command to run, and if it completes successfully, for "(other_command)" to run. For instance, cd ..\.. and then yarn clean.

If bash mode doesn't want to run chained commands, I think that's okay, but it should detect && and || and ; (and |? maybe other things?) and provide an error to the effect that chained commands are not allowed.

Actual Behavior

I got the error, cwd error: Path "(dirpath && other_command)" does not exist

Additional Context

Screenshot:

!Image

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗