#!/bin/bash -e

trap "rm test_fifo" 0
mkfifo test_fifo

ls / > test_fifo &

exec 9<&0

while read dirname
do
  echo $dirname

  # if I wait, exits!!!
  read -t 2 -p "press enter..." 0<&9
done < test_fifo

exec 9<&-

exit 0


Reply via email to