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
>
>
Hello,
I have these three very simple scripts. The only difference between them is the
penultimate line of each of them:
| $ head -n 6 just_pipe just_for_loop pipe_and_for_loop
| ==> just_pipe <==
| set -e
| trap 'echo aborted in line $LINENO' ERR
| echo start
| true | false
| echo ended succes
#!/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