[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is it a bug? (little script)
From: |
pk |
Subject: |
Re: is it a bug? (little script) |
Date: |
Sun, 05 Oct 2008 22:08:27 +0200 |
On Sunday 5 October 2008 17:17, Antonio Macchi wrote:
> #!/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
You know what -e does, don't you?
An expired timeout for read returns failure (as clearly stated in the
manual), so what you see is just the expected behavior.
(and, btw, fiddling with the descriptors is totally useless and confusing
here, since it is not related to the "problem").