I write a script to get data from HDFS parrallel,then I wait these child processes in a for loop, but sometimes it returns \"pid is not a child of this shell\". sometimes, i
Either your while loop or the for loop runs in a subshell, which is why you cannot await a child of the (parent, outer) shell.
Edit this might happen if the while loop or for loop is actually
(a) in a {...} block (b) participating in a piper (e.g. for....done|somepipe)
{...}
for....done|somepipe