Bash tool: newline between commands in a single call is treated as a space, merging them into one pipeline

Status Fixed / completed
Maintainer reply None cached
Activity 2 comments · opened Mar 9, 2026 · closed Mar 9, 2026

Bug

When passing multiple commands separated by a newline in a single Bash tool call, the newline is treated as a space rather than a command separator. This silently merges the commands into a single pipeline, producing unexpected behavior.

Example

The following input (intended as two separate commands):

cargo search reqwest 2>&1 | head -3
curl -s "https://example.com" | grep foo

Gets executed as:

cargo search reqwest 2>&1 | head -3 curl -s "https://example.com" | grep foo

So head receives curl, -s, and the URL as arguments, producing:

head: invalid option -- 's'

Expected behavior

Newlines between commands should either be treated as && separators, or the Bash tool should reject/warn when multiple newline-separated commands are passed and instruct the model to use \&&\ or separate tool calls instead.

Impact

This is a silent correctness issue — the error message (head: invalid option -- 's') gives no indication that command merging occurred, making it hard to diagnose. A model could unknowingly execute unintended commands as a result.

View original on GitHub ↗

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