#!/bin/sh
mkfifo tmp.$$
exec 4<>tmp.$$
rm -rf tmp.$$
{
count=4
while [ $count -gt 0 ]
do
echo
let count=count-1
done
} >&4
for((i=1;i<6;i++))
do
read <&4
(sleep $i;echo >&4)&
done
wait
exec 4>&-
转载于:https://blog.51cto.com/biott/1123101