On 8/13/14, 12:42 PM, Greg Wooledge wrote:
> This was tested on bash 4.3.22 (HP-UX) and bash 4.2.37 (Linux).
> 
> Create a script named foo with the following content:
> 
> #!/bin/bash
> set -m
> while sleep 1; do :; done
> 
> Make it executable, and type
> 
> ./foo &
> 
> at an interactive shell.  You get your shell prompt back.  You can press
> Enter as many times as you like.  But if you press any key other than
> Enter, the entire terminal window goes away.

I haven't looked at this yet, but here's what I bet is happening: turning
on job control with set -m causes several things to happen: the shell
creates a new process group and becomes the process group leader, sets the
terminal's process group to its own process group, and creates children in
their own process group.

Now that the terminal is no longer in the parent shell's process group,
reads return EOF (or -1/EIO), and the parent shell exits.

The details may not be exactly this, but this is the general set of events.

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