On 7/27/13 1:32 PM, Andreas Schwab wrote:
> Chris Down <[email protected]> writes:
>
>> Cannot reproduce.
>>
>> $ printf 01 | read -n3
>> $ echo $?
>> 1
>
> Try the same with input from the terminal.
You are reading one character at a time, so ICANON is not set and ^D is an
ordinary character. It's only `recognized' as EOF when ICANON is set and
the ^D is typed as the only character on a line.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/