On Fri, Nov 25, 2011 at 6:34 PM, Bart Schaefer barton.schaefer@gmail.com wrote:
Next you create wget #2, which (because it was forked from the parent shell) shares all the file descriptors that the shell had open to wget #1, e.g., including the input to the fifo. Repeat for all the rest of the wget. By the time you have created the last one, each of them has a set of descriptors shared with every other that was created ahead of them.
Thus, even though you write to the fifo for wget #2 and close it from the parent shell, it doesn't actually see EOF and begin processing the input until the corresponding descriptor shared by wget #1 is closed when wget #1 exits.
I wrote that backwards. Actually I think the *last* one (#20) exits first, and then #19, and so on down to #1 ... but the descriptor management issue is the same.