2010-12-24, 13:20(+05), Коренберг Марк: [...] > mma...@mmarkk-work:/tmp$ echo aaa > /tmp/test1 > mma...@mmarkk-work:/tmp$ read x < /tmp/test1 && echo success > success > mma...@mmarkk-work:/tmp$ echo $x > aaa > mma...@mmarkk-work:/tmp$ > > BUGGY CASE: > mma...@mmarkk-work:/tmp$ echo -n bbb > /tmp/test2 > mma...@mmarkk-work:/tmp$ read y < /tmp/test2 && echo success > mma...@mmarkk-work:/tmp$ echo $y > bbb > mma...@mmarkk-work:/tmp$ > > So, if EOF detected but something is read successfully, please do not > report error ! [...]
Bash behavior is the same as every other shell, is as documented and as specified by POSIX. if read can't read a line (because of a read error or EOF found before the line terminator is found) it should return a non-zero exit status and fill the variable with the caracters read thus far. -- Stephane