help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Duplicate one stdin as inputs to multiple programs witho


From: Pierre Gaston
Subject: Re: [Help-bash] Duplicate one stdin as inputs to multiple programs without creating temp files
Date: Mon, 13 Feb 2012 08:00:26 +0200

On Mon, Feb 13, 2012 at 6:52 AM, Peng Yu <address@hidden> wrote:
Hi,

I have one input stream that needs to be fed to multiple programs
(they do not depends on each other, so that they can run in parallel).
As of now, I do something like the following, which needs a temp file.
But I don't like the idea of creating a temp file (as it may take
large disk space when the input is large). All prog1-3 can process the
input bit by bit, so if there is a way to somehow create three streams
that exactly the same as stdin, I think that the three programs can
run more efficiently (without being slowed by disk). I'm wondering if
there is a way to do so? Thanks!

~$ cat main2.sh
#!/usr/bin/env bash

> file
#These programs can run in parallel
prog1 < file &
prog2 < file &
prog3 < file &

--
Regards,
Peng

tee <file >(prog1) >(prog2) >(prog3) >/dev/null

reply via email to

[Prev in Thread] Current Thread [Next in Thread]