I'm still trying to find a _good_ way, but this should at least work:
If you really want it to go to two files (real files), it's easy:
| tee file1 > file2
"tee" writes one copy to the filename you give it, and the other to stdout. Redirect stdout to file2, and you're in good shape.
If you want to do what it looks like you want from what you wrote, which is to pipe it to two different programs, it's not as easy. You can still make it work with tee, but it's a kludge:
Make a named pipe. In this example, I'll call it "pipe2two".
Set up your email pipe:
| tee pipe2two | script1.php
The very first thing in script1.php should be:
cat pipe2two | script2.php &
(That "&" on the end is important, it makes it run in the background and lets the rest of script2 run.)
I don't know php. If it won't let you kick off a command like that cat, you might have to do it with a bash script. The same basic idea applies: use a named pipe (or two, or three) to fool tee into thinking it's writing to a file, then do a "cat" fromt the named pipe to the program that needs the data.
Hope this helps,
CHL
|