Shell 多线程

'''

! /usr/bin/env bash

trap "exec 1000>&-;exec 1000<&-;exit 0" 2

mkfifo testfifo
exec 1000<>testfifo
rm -rf testfifo

for ((n=1;n<=10;n++))
do
echo >&1000
done

start=date "+%s"

for ((i=1;i<100;i++))
do
read -u1000
{
echo success$i; sleep 5
echo >&1000
}&
done
wait

end=date "+%s"
echo "time: expr $end - $start"

exec 1000>&-
exec 1000<&-

'''

原文地址:https://www.cnblogs.com/yxzfscg/p/5573631.html