Parallel shell scripts.

Andrew Pantyukhin infofarmer at FreeBSD.org
Wed Nov 8 10:29:16 UTC 2006


On 11/8/06, nicky <nicky at valuecare.nl> wrote:
> I have to start 2 processes in the background (running in parallel),
> capture their return codes and after all 4 have completed successfully i
> want to continue with the main script.

What do you need their return codes for? If you
only want to display them, something like this
might help:

(/bin/proc1;echo "Proc 1 exited with status $?) &
(/bin/proc2;echo "Proc 2 exited with status $?) &
wait

In general, retrieving exit statuses of multiple
general is not trivial. I.e. you need some kind of
IPC for that, at least store statuses in some tmp
files and read it back from the main process.


More information about the freebsd-questions mailing list