#!/bin/bash
# ----------------------------------------------
# ----------------------------------------------

function DEBUT {
echo ""
[ -p monpipe ] && rm -f monpipe
mkfifo monpipe
[ -p monpipe2 ] && rm -f monpipe2
mkfifo monpipe2

{ for((i=0;i<=10;i++)); do echo $i ; done ; } >monpipe &
{ for((i=0;i<=10;i++)); do echo $i ; done ; } >monpipe2 &

while read unNum
do
echo "${unNum}"
# echo $monpipe2
done <monpipe <monpipe2

rm -f monpipe    
rm -f monpipe2    


}
DEBUT

# exit
# ----------------------------------------------
function DEBUT2 {
    echo ""

[ -p monpipe ] && rm -f monpipe
mkfifo monpipe
# [ -p monpipe ] && rm -f monpipe
# mkfifo monpipe

{ for((i=0;i<=100;i++)); do echo $i ; done ; } >monpipe &
# { for((i=0;i<=100;i++)); do echo $i ; done ; } >monpipe &

while read unNum
do
echo "${unNum}"
done <monpipe

# rm -f monpipe    
rm -f monpipe


}
DEBUT2

exit