help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Duplicate one stdin as inputs to multiple programs without c


From: Peng Yu
Subject: [Help-bash] Duplicate one stdin as inputs to multiple programs without creating temp files
Date: Sun, 12 Feb 2012 22:52:48 -0600

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



reply via email to

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