bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Terminating background bash kills the parent?


From: Chet Ramey
Subject: Re: Terminating background bash kills the parent?
Date: Wed, 26 Dec 2018 11:42:00 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 12/20/18 12:02 AM, Bize Ma wrote:
> Open a new terminal like xterm, change prompt to something like:
> 
>     PS1=' $SHLVL $ '
> 
> Start a couple of bash subshells:
> 
>     1 $ bash
>     2 $ bash
>     3 $ echo $$
>     9371
> 
> Suspend the last one:
> 
>     3 $ suspend
>     [1]+ Stopped                 bash
>     2 $ echo $$
>     9313
>     2 $
> 
> Make the suspended shell continue:
> 
>     2 $ kill -CONT 9371
>  
> The parent gets killed
> 
>     1 $ echo $$
>     9034
>      1 $

The terminal ends up in the wrong process group, and the parent shell can't
do anything about it. You either get EOF on stdin, -1/EIO on the read, or a
SIGHUP.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]