thread=5 tmp_fifofile=/temp/$$.fifo mkfifo $tmp_fifofile exec 8<>$tmp_fifofile rm $tmp_fifofile for i in `seq $thread` do echo >&8 done while : do read -u 8 { ....代码
echo >&8
}& donewaitexec 8>&-#释放文件