Capturing Output
Capture exec stdout and use it as input for subsequent steps.
capture
Demonstrates capturing exec stdout and using it as input for subsequent steps.
Setup
bunx alineo-cli init # starts OpenSandbox in Docker (one-time setup)Run
bun install
bun startWhat it does
- Creates a
node:20-slimsandbox - Runs a Node.js one-liner and captures its stdout (the Node version string)
- Interpolates the captured value into a subsequent exec command
- Writes a JSON file into the sandbox using the captured value
- Reads the file back with
sb.readFile()and prints it