[vox-tech] removing kill messages

Micah J. Cowan vox-tech@lists.lugod.org
Wed, 6 Aug 2003 10:10:56 -0700


On Tue, Aug 05, 2003 at 07:28:05PM -0700, Mark K. Kim wrote:
> hi guys.  so when i launch an app in the background and i kill it like
> this:
>=20
>    $kill $pid
>    $
>=20
> then it displays something like:
>=20
>    $
>    [1]+  Terminated              xv
>=20
> but if i'm doing this in a script, i want the display to not appear at
> all.  how do i stop this message from displaying?  thanks in adv!

This message is only displayed for a "job" of the shell's. And it's
only displayed when bash gets ready to display a shell prompt. I may
be wrong, but I don't think it gets displayed in noninteractive shells
(such as one used to run a script). But it *definitely* won't display
for a "disown"ed process which is no longer considered a "job".

"disown" is a bash builtin which disassociates a job from the current
shell. I use it (indirectly) quite a lot: I frequently find it
convenient to launch GUI apps from the command-line; however, I don't
like 'em cluttering up the job list, as my customized bash prompt
lists current jobs and their job numbers. For instance, my current
prompt (after suspending mutt) looks like:

  =1B[32mmicah(=1B[31m1=1B[1;33mmutt=1B[0;32m)$=1B[0m

(If you can't read the above, or it just looks like inverted text, try
piping this mail through "less -r" or something).

Or, for those whose mail-readers won't allow the interpretation of the
ANSI codes above:

  micah(1mutt)$
  ^^^^^^*----^^

Where the different underscoring characters denote distinguishing
colors (on the FreeBSD machine I'm shelled into at the moment, that's
green, red, and bold-yellow, respectively). I find this handy to keep
various console-oriented programs suspended and switch between them;
but I don't like having my background processes showing up there. So I
use a small script named "spawn" which simply launches the command in
the background and disowns it (I think it uses nohup, too - can't
remember).

disown is a builtin, though, so only available for bash, though other
programs may also have a disown command or similar. Also, disown
hasn't always been around, and may not be available in older versions
of bash.

HTH,
-Micah