Jeff Chua wrote:

> Revisited. The previous reply to your example works fine for interactive
> shell. But for a script  (non-interactive shell), the example does not
> work the same. Job status are always reported even with "set +m" in the
> script. ...

Right.  This is part of my previous answer, which you quoted:

>> Bash and historical versions of sh report the status of jobs in a script
>> that exit as the result of being killed by a signal.  I'm not going to
>> change that.

This functionality predates and is independent of job control.  Shells
back to at least the original Bourne shell (7th Edition) have done it.


> Is there another alternative to do this? "disown" would not work for
> situation where "wait" is used to wait for child to finish  ...

Sure.  Since the status messages are written to stderr, you can save
file descriptor 2 and temporarily (or permanently, depending on your
needs) redirect it to /dev/null.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/


Reply via email to