Operating System - HP-UX
1753529 Members
5263 Online
108795 Solutions
New Discussion юеВ

using wait command on completed jobs

 
Chris Baugh
Occasional Advisor

using wait command on completed jobs

If the wait command is issued on a process ID, where the process ID relates to a job that has completed, and hence the process ID is no longer in existance, is it safe to assume that the returncode from the wait command would be 127?
3 REPLIES 3
unixdaddy
Trusted Contributor

Re: using wait command on completed jobs

I would say yes. Try it by issuing a wait against a non-existent pid and then issue the $? straight afterwards it should return 127.
unixdaddy
Trusted Contributor

Re: using wait command on completed jobs

That should read echo $?
John Palmer
Honored Contributor

Re: using wait command on completed jobs

From some experiments on both HP-UX 11.00 and 10.20, it appears that two waits of the form:
wait
will successfully return the return code from
A third wait returns 127.
Note this is when has been issued by the shell with &
Thus it is only safe to assume a response of 127 on the third (and subsequent calls to wait).

However if you use the format
wait
where is %1 for instance (or %% for the last job issued) then only the first wait returns the valid return code for the job. All subsequent waits of this form return 1.

Regards,
John