[...]
while read -t 2 -u 4 RESULT
[...]
I thought the read -t 2 ... should timeout after 2 seconds if no data is received. Any idea why this hangs?
Does that work other than when reading from a pipe or live terminal? The -u is pointing it at a file descriptor, so that might hang it.
I did some testing yesterday, and found that -t 2 does seem to work with file descriptors, even though the man page says it shouldn't (under bash 3.0). I tried removing the timeout, and the script hangs indefinitely at the first call to read - obviously waiting for data.
I think I'll have to accept that any hang of more that 2 seconds indicates a failure, and CRTL+C should be used.
Many thanks for the help.
Stuart.