aboutsummaryrefslogtreecommitdiffstats
execline: the pipeline command

execline
Software
skarnet.org

The pipeline program

pipeline runs two commands with a pipe between them.

Interface

In an execlineb script:

     pipeline [ -d ] [ -r | -w ] { prog1... } prog2...
  • pipeline reads prog1... in a block and unquotes it.
  • It runs prog1... as a child process and execs into prog2..., with a pipe between prog1's stdout and prog2's stdin.
  • prog1's pid is available in prog2 as the ! environment variable.

Options

  • -d : run prog1... as a grandchild of pipeline. This is meant to prevent a zombie from hanging around if prog2... fails to wait for its children.
  • -r : make prog1... the writer and prog2... the reader. This is the default.
  • -w : make prog1... the reader and prog2... the writer.

Notes

  • You can easily create a chain of pipes: execlineb -Pc 'pipeline { a } pipeline { b } c' is roughly equivalent to sh -c 'exec a | b | c', except that shells usually run c as a child process like a and b, and exec has no effect.