On 5/13/22 4:56 PM, Robert Elz wrote:
Date: Fri, 13 May 2022 11:22:20 -0400
From: Chet Ramey <chet.ra...@case.edu>
Message-ID: <a90562c2-c917-fc76-b515-9f69868f0...@case.edu>
| Show your work.
|
| I tested this on macOS 12 and RHEL 7, using interactive shells with job
| control enabled,
That is likely the difference. The question was about what happens when
job control is not enabled.
The same thing. This example uses bash-5.2-beta on macOS 10.15, but the
same thing happens with bash-5.1.16.
$ ./bash
$ set +m
$ sleep 20 | sleep 20 &
[1] 22755
jenna.local(2)$ pstree $$
-+= 22753 chet ./bash
|--- 22754 chet sleep 20
|--- 22755 chet sleep 20
\-+- 22756 chet pstree 22753
\--- 22757 root ps -axwwo user,pid,ppid,pgid,command
$ kill %1
$ ps ax | grep sleep
22759 s018 S+ 0:00.00 grep sleep
$ sleep 20 | sleep 20 & pstree $$
[1] 22787
-+= 22753 chet ./bash
|--- 22786 chet sleep 20
|--- 22787 chet sleep 20
\-+- 22788 chet pstree 22753
\--- 22789 root ps -axwwo user,pid,ppid,pgid,command
$ kill %1
$ ps axuw | grep sleep
chet 22791 0.0 0.0 4408552 764 s018 S+ 10:25AM
0:00.00 grep sleep
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/