Skip to content

[BUG]: Shell mode escapes pasted newlines in multi-line commands #27080

@js0ny

Description

@js0ny

Description

When pasting multiple shell commands into shell mode, OpenCode does not preserve the newline as a real shell command separator. The pasted newline appears to be escaped or flattened before execution, so the second command becomes part of the first command's argument.

This differs from normal shell behavior, where a newline between commands is a valid command separator.

I also tested the same input in Claude Code and Pi, and both preserve the newline semantics and execute the commands correctly.

Why this matters

Pasting multi-line shell snippets from documentation is a common CLI workflow.

Plugins

@mohak34/opencode-notifier@latest, opencode-btw

OpenCode version

1.14.44

Steps to reproduce

  1. Open OpenCode.
  2. Enter shell mode.
  3. Paste the following two-line command block:
curl -O https://raw.githubusercontent.com/BerriAI/litellm/main/docker-compose.yml
curl -O https://raw.githubusercontent.com/BerriAI/litellm/main/prometheus.yml
  1. Check the downloaded files:
$ ls
$ cat docker-compose.ymlncurl

Expected behavior

The pasted input should preserve the real newline between commands, equivalent to running:

curl -O https://raw.githubusercontent.com/BerriAI/litellm/main/docker-compose.yml
curl -O https://raw.githubusercontent.com/BerriAI/litellm/main/prometheus.yml

Expected result:

docker-compose.yml
prometheus.yml

Actual behavior

The newline is not preserved as a shell command separator. Instead, it appears to be escaped or flattened and interpreted as part of the command argument.

Observed result:

$ ls
docker-compose.ymlncurl  prometheus.yml

$ cat docker-compose.ymlncurl
404: Not Found

This suggests the command may be executed as:

curl -O https://raw.githubusercontent.com/BerriAI/litellm/main/docker-compose.yml\ncurl -O https://raw.githubusercontent.com/BerriAI/litellm/main/prometheus.yml

Screenshot and/or share link

Image

Operating System

NixOS 26.05 (Yarara) x86_64

Terminal

ghostty 1.3.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions