Skip to content

Shell echo command should support -n flag #660

Description

@LSantha

Summary

Add a -n flag to the shell echo command to suppress the trailing newline, matching common shell behavior.

Problem

Scripts that build output incrementally (prompts, progress lines) cannot avoid the trailing newline today. Workarounds via printf do not exist in this shell.

Proposal / Spec

  • echo -n <args> prints args separated by spaces with no trailing newline.
  • echo <args> behavior unchanged.
  • Touch zone: shell builtin echo command implementation plus its help text.

Requirements

  • Functional: -n must be first-arg only; echo -n alone prints nothing and exits zero.
  • Non-functional: Java 1.6 only, US-ASCII, existing formatter, no new dependencies.
  • Out of scope: escape-sequence interpretation (no -e flag in this issue).

Acceptance Criteria

  • echo -n hello outputs hello with no newline.
  • echo hello output byte-identical to before.
  • Help text documents -n.

How to Test

  • Unit: hosting shell command test module if present, else boot QEMU and compare shell output bytes.
  • New tests added for the -n case.

Alternatives Considered

  • printf builtin: larger scope, separate issue.
  • No change: leaves scripts without the capability.

❌ Ticket Runner Status

Field Value
Phase FAILED
Turn 0/3
Retries 3/3
PR -
Started 2026-09-20T14:15:56.889Z

Triage Addendum (auto, 2026-09-20)

  • Area / Kind: area/shell + kind/feature
  • Blast radius: L2 package (org.jnode.shell.bjorne, new EchoBuiltin plus registration, no plugin export)
  • Expected scope: 1 new file plus registration plus help text, ~50 lines; no ASM, boot, or API changes
  • Test path: cd shell && ant test, plus new builtin test cases
  • Merge signal: human-review (feature kind; small scope but needs human scope decision)
  • Gaps: none
  • Full report: ## Triage comment below.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/failedThe agent exhausted its retries without producing a result.area/shellshell/ — command framework, built-in commands, bjorne evaluator.kind/featureNew feature or enhancement request.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions