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