On 8/25/14, 4:24 PM, Stephane Chazelas wrote:
> If you run (here testing on Linux):
> 
>   bash -c 'read a; echo "<$a>"; tr b c'
> 
> And enter aaa<Ctrl-V><Ctrl-J>bbb<Return>
> 
> You see "<aaa>", but not "ccc". That's because "read" reads up
> to 128 bytes of data in one read(2) invocation instead of
> reading one byte at a time like on other types on non-seekable
> files.

While this is true, it's not complete.  Bash relies on the terminal
driver returning newline-delimited lines when reading from the
terminal.  If you try to fool it, you can probably succeed.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to