#!/bin/bash
# 设置并发数
thread_num=3
# 创建管道文件
FIFO=/tmp/$$-FIFO
mkfifo $FIFO
# 使用句柄打开管道文件
exec 1000<>$FIFO
rm -f $FIFO
# 向管道里面输入若干行
for i in `seq $thread_num`
do
echo "" >&1000
done
## == main == ##
for i in `seq 10`
do
read -u 1000
{
echo $i
sleep 5
echo "" >&1000
}&
done
wait
echo end
标签:shell,seq,FIFO,echo,并发,num,1000
From: https://www.cnblogs.com/dewan/p/16896387.html