> Any ideas?

Pipelines in bash aren't quite what they should be :(

I have an idea which might solve part of your problem. Run programs in
the background and connect them with filedescriptors, like

exec 3< <( ... )
exec 4> >( ... )

You'd need to think about how to use the fds and redirection. Warning:
this is not in the bash documentation, and Mr Google couldn't really
tell me either how and why it works. It's a pain to make it work.

$! gives you "the PID of the last process started in the background",
and it is set by those execs. This gives you one $! per process
(becasue you can start them one after the other).

What I *really* like to know is how to get the return status of all the
background processes. One can use wait on them, but that a) barfs if the
process has already terminated, b) no longer makes it background, c) one
can't get the exit code of more than one process that way.

For foreground pipes, it's impossible to get the exit code of any but
the last pipe (bad design). I'd also really like to know how to get the
exit codes of all of the earlier commands in the pipeline - otherwise
safe programming is not possible: an earlier command might make the sky
crash down, and bash happily reports "success" at the end of the
pipeline (doh, tcsh gets this right).

Volker

-- 
Volker Kuhlmann                 is possibly list0570 with the domain in header
http://volker.dnsalias.net/             Please do not CC list postings to me.

Reply via email to