Repository navigation
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
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
Begin here
Values and expressions
- Language basics
- Variables and scope
- Numbers and logic
- Strings and paths
- Arrays
- Hash maps
- Ranges and iteration
- Control flow
- Match and type guards
Functions and types
- Functions and calls
- Closures and function types
- Methods and properties
- Structs
- Enums
- Named types and unions
- Conversions
- Types and properties
Shell and modules
- Pipelines
- Pipeline splits
- Pipeline formats
- Commands and exit status
- Redirection
- Environment and exported variables
- Modules and visibility
- Nested modules and directory packages
- Conditional imports and declarations
- Errors and cleanup
- Supervised processes and terminals
Library guides
- Standard library
- The implicit prelude
- Bytes, files, readers, and writers
- Explicit item streams
- JSON documents and typed mapping
- Sockets, DNS, and TLS
- HTTP clients
- HTTP servers
- Framing, server-sent events, and JSON-RPC
- Terminal colors, styles, and geometry
- Build an application console
Interactive use