coproc { echo a b c; sleep 2; }

echo $COPROC_PID
echo ${COPROC[@]}

read LINE <&${COPROC[0]}
echo $LINE

wait $COPROC_PID

coproc REFLECT { cat - ; }

echo $REFLECT_PID
echo ${REFLECT[@]}

echo flop >&${REFLECT[1]}
read LINE <&${REFLECT[0]}

echo $LINE

kill $REFLECT_PID
wait $REFLECT_PID

coproc xcase -n -u

echo $COPROC_PID
echo ${COPROC[@]}

echo foo >&${COPROC[1]}
read <&${COPROC[0]}

echo $REPLY
echo ${COPROC[@]}

cat /etc/passwd | grep root | awk -F: '{print $1;}' | sed 1q

exec 4<&${COPROC[0]}-
exec >&${COPROC[1]}-

echo ${COPROC[@]}

read foo <&4
echo $foo >&2

exit 0
