Unix-Style Stream and File Input

Parent: PROGRAMMING_RULES

For command-line tools that consume one logical stream of records, follow the behaviour associated with Perl's diamond operator <>, even when implementing the tool in another language.

producer | analyser
analyser input.txt
analyser first.txt second.txt
producer | analyser first.txt - last.txt

Why

Implementation guidance

When not to force this pattern

Use a different explicit interface when inputs have distinct roles, require random access, must be correlated rather than concatenated, or are unsafe to accept from an unbounded stream. Even then, support - for a single stream-valued input where it remains unambiguous and safe.

version 2  ·  created 2026-09-16  ·  updated 2026-10-06  ·  tags programming, cli, unix, stdin, files, pipelines