infamous41md |
07-15-2004 09:37 PM |
you should try a an approach that works on any number of pipelined processes. you should have an array of pipes, pipes[NPIPES][2]. after u have a command line, go thru and for each pipe fork a child, duplicate descriptors, and execute the command. to control when to duplicate descriptors, well you know that every child after the first will have its standard input duplicated, and every command except the last has its output duplicated. something that is very informative is
$ strace -vf /bin/sh ls | sort | grep -v bla
|