1 2failures= 3failure() { 4 echo "Error at line $1" >&2 5 failures=x$failures 6} 7 8T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) 9trap 'rm -rf $T' 0 10cd $T || exit 3 11mkfifo fifo1 12for i in 1 2 3 4 5 6 7 8 9 10; do 13 exit $i 4<fifo1 & 14done 15exec 3>fifo1 16wait || failure $LINENO 17(${SH} -c echo >&3) 2>/dev/null && failure $LINENO 18wait || failure $LINENO 19 20test -z "$failures" 21