1. 程式人生 > >shell 並發

shell 並發

read ech don $$ ash amp ++ mkfifo emp

#!/bin/bash

tempfifo=$$.fifo

trap "exec 1000>&-;exec 1000<&-;exit 0" 2
mkfifo $tempfifo
exec 1000<>$tempfifo
rm -rf $tempfifo

for ((i=1; i<=8; i++))
do
echo >&1000
done

for i in seq 100
do
read -u1000
{
echo "-------------->"$i
echo >&1000
sleep 3
} &
done

wait
echo "done!!!!!"

shell 並發