Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14809 > unrolled thread

Strange behaviour from jobs -p in a subshell

Started byChristopher Jefferson <caj21@st-andrews.ac.uk>
First post2018-11-13 09:28 +0000
Last post2018-11-13 09:28 +0000
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  Strange behaviour from jobs -p in a subshell Christopher Jefferson <caj21@st-andrews.ac.uk> - 2018-11-13 09:28 +0000

#14809 — Strange behaviour from jobs -p in a subshell

FromChristopher Jefferson <caj21@st-andrews.ac.uk>
Date2018-11-13 09:28 +0000
SubjectStrange behaviour from jobs -p in a subshell
Message-ID<mailman.3977.1542119200.1284.bug-bash@gnu.org>
Consider the following script. While the 3 sleeps are running, both jobs 
-p and $(jobs -p) will print 3 PIDs. Once the 3 children are finished, 
jobs -p will continue to print the 3 PIDs of the done Children, but 
$(jobs -p) will only print 1 PID. $(jobs -p) always seems to print at 
most 1 PID of a done child.


#!/usr/bin/bash

(sleep 2 ) &
(sleep 2 ) &
(sleep 2 ) &

while /bin/true
do
     echo A
     echo $(jobs -p)
     echo B
     jobs -p
     echo C
     sleep 1
done

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web