On 02-Apr-08 09:53:01, Chris G wrote:
I want to send standard input to two places, both of which are shell (well, actually python and perl) scripts. I assume I need to use tee but it's not obvious how to do it.
No, it's not obvious! "tee anything" echoes its input to stdout and also writes its input to the file named "anything". If "anything" is "-" (in recent versions of 'tee'), then you get a second copy to stdout, i.e. you see each input line twice.
I assume each of your two scripts is looking for input on stdin. But if you did "tee script1 | script 2" it would be read by script2, but would overwrite script1.
The only way I can think of is to create a FIFO ("Named pipe") and then use this as the named argument to 'tee', having set up script1 to read from the FIFO.
On the lines of
mkfifo MyFIFO script1 < MyFIFO cat whatever | tee MyFIFO > script2
While this, in princple, does the sort of thing you're asking about (i.e. both script1 and script2 will read copies of the output of "cat whatever"), I doubt whether it will fit into the general scenario you describe below.
I hope someone else has a better idea! Ted.
My actual requirement is for .forward to send incoming mail messages to an (old) perl script and a (new, replacement) python script while I write and debug the new python script.
The existing .forward file is:-
| /home/isbd/bin/filter.pl
How do I change this so it sends its standard input to both /home/isbd/bin/filter.pl *and* /home/isbd/bin/filter.py?
-- Chris Green
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 02-Apr-08 Time: 11:18:45 ------------------------------ XFMail ------------------------------