bash job control output redirection madness

Lonni J Friedman netllama at gmail.com
Tue Mar 24 08:18:25 PDT 2009


Hopefully someone has run across this before and has some ideas.

I've got a (bash) shell script (foo.sh) that calls another shell
script(bar.sh) and backgrounds it at the same time.  Later on, foo.sh
kills bar.sh.  That much works fine.  The problem is that when bar.sh
gets killed (with kill), the shell spews output like this:
./foo.sh: line 57: 12434 Terminated              ~/bar.sh
./foo.sh: line 57: 13707 Terminated              ~/bar.sh


Its that 'Terminated' bit that I need to suppress somehow.  I've tried
both of the following without any success:
0) Run bar.sh with all output redirected:
~/bar.sh & > /dev/null 2&1
1) Run bar.sh inside a subshell and then redirect all the output from
the subshell:
( ~/bar.sh > /dev/null 2&1 ) & > /dev/null 2>&1


I've also tried supressing the output from the kill command to
/dev/null, but I'm pretty sure that the 'Terminated' output is coming
from the shells that owns bar.sh and not from the kill command.

Anyone have any ideas here?

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama at gmail.com
LlamaLand                       https://netllama.linux-sxs.org



More information about the Linux-users mailing list