Hi,

This is a question similar to one from September 2006:

http://lists.gnu.org/archive/html/bug-bash/2006-09/msg00077.html


Using bash 3.2.39 on x86_64 RHEL5.2, I have a script with contents:


function bar ()
{
    sleep 10 &
    pid=$!
    exec 3>&2 2>/dev/null
    kill $pid
#    usleep 1
    exec 2>&3 3>&-
}

bar


If I run this script 1000 times via a loop, I get a handful of messages
(the number varies) of the form:

/path/to/script: line 14: 10327 Terminated              sleep 10

If I uncomment the "usleep" line, I get no such messages at all.

If I comment out the usleep and both exec lines, I get a handful of messages.

If I then uncomment the usleep line, I get 1000 messages.


Hence, some questions:

1) Shouldn't the production of the "terminated" message be deterministic?

2) Why does sleeping make a difference?

3) Is there a "right" way to suppress the "terminated" message?

Thanks in advance.



Reply via email to