Hello,

This might be a bit off topic, but can't find anything really useful when searching the internet. So i hope someone can point me in the right direction

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.

Sofar i have this (below), however is this the proper way to do it?

#!/bin/sh -

PIDLIST=""

./childprocessA.sh &
PIDLIST="$PIDLIST $!"

./childprocessB.sh &
PIDLIST="$PIDLIST $!"

for PID in $PIDLIST; do
       wait $PID
       rc=$?
       echo "Job $PID exited with status $rc"
       if [ $rc -ne 0 ]; then
         exit $rc
       fi
done

**** the rest of the main script ****


Regards,
Nick
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to