sean finney on 30 Jun 2004 23:30:03 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Mappings background pids to their exit status


On Tue, Jun 29, 2004 at 10:21:11PM -0400, ss396@drexel.edu wrote:
> Presently I am following this logic:
> 
> 1. Spawn the processes and store the pids in an array.
> 2. Do a wait on each pid in the array.

wait is shell-specific, but in bash at least, i think this would
be doable

> Though, this makes sure that all the processes are being exited, I would like to make sure that each of the process exited with status 0.
> 
> $? doesn't help me in finding the exit status of the background processes.

are you sure about that?  that is, if you wait on a process by it's id,
doesn't wait return the exit status of the program?

(from bash's builtins(1), not sure if this applies to ksh)

       wait [n]
              Wait for the specified process and return its  termination sta-
              tus.   n  may  be  a process ID or a job specification; if a job
              spec is given, all processes in that job's pipeline  are waited
              for.   If  n  is not given, all currently active child processes
              are waited for, and the return status is zero.  If n specifies a
              non-existent  process  or job, the return status is 127.  Other-
              wise, the return status is the exit status of the  last process
              or job waited for.


	sean

Attachment: signature.asc
Description: Digital signature