Some more research (google -> bash FAQ) revealed that co-processes are not supported directly.
Instead, one can use a named pipe pair (one for input and one for output).
There are two options: 1) place the extra code in your script.
2) source the functions/coproc.bash (from the 3.2 distribution)
ex.
Code:
local fifo="/var/tmp/getoptions.$$.$RANDOM"
mkfifo $fifo || {
echo "$(basename $0): getoptions: Error creating named pipe. Exiting." >&2
exit 2
}
( find . >$fifo ; rm -f $fifo ) &
trap 'echo Received SIGPIPE >&2' SIGPIPE
globalvar=
while read; do
# first loop
:
done <$fifo
# do something with globalvar
while read; do
#second loop
:
done <$fifo
trap - SIGPIPE