bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in read implementation and/or documentation


From: Chet Ramey
Subject: Re: Error in read implementation and/or documentation
Date: Sat, 27 Jul 2013 16:10:17 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

On 7/27/13 1:32 PM, Andreas Schwab wrote:
> Chris Down <chris@chrisdown.name> 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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]