Skip to content

Redirection

Chloë Strainge edited this page Oct 14, 2026 · 1 revision

Redirection

Arrows move data left to right. They select streams independently of the typed pipeline operator.

Operator Stream
-> Standard output
~-> Standard error
~+-> Both output streams

A variable target receives captured text. A quoted or interpolated path target is a file destination. Capture preserves bytes representable as UTF-8, including trailing newlines; trimming is explicit.

let $message: String
let $status = printf 'parcel\n' -> $message
echo $message.count $status
echo $message.trim
7 ExecResult(0)
parcel

Files and process input

A String value on the left of a file-reading arrow names a source file. A value piped into an external program supplies process input. Use a pipe when passing variable contents rather than reading a filename.

printf '%s' "cargo list" -> "manifest.txt"
let $contents: String
"manifest.txt" -> $contents
echo $contents
cargo list

Redirection is scoped to the command: later output returns to the usual stream. Keep execution status separate from captured text. For binary data, use Bytes and I/O; String capture is not a binary container. For bounded child execution with separate files and environment, use Process supervision.


Related: Pipelines · Bytes and I/O · Process supervision

Clone this wiki locally