bug-bash
[Top][All Lists]
Advanced

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

Re: `read' builtin does not take last record without trailing delimiter


From: Chet Ramey
Subject: Re: `read' builtin does not take last record without trailing delimiter
Date: Tue, 26 Feb 2008 16:08:10 -0500
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)

Jan Schampera wrote:
Scott Mcdermott wrote:
Bash does not seem to take the last record if it has no
trailing delimiter:

I'm sure Chet accepts patches, if he thinks it's a bug. I'm not sure if
it's a bug per se, but at least it's a usability issue to discuss. Maybe
it can be reduced to "read reacting on EOF" - and yes, the current
behaviour of reaching EOF is documented in the manual, and personally
I'm fine with it.

I don't think it's a bug.  To change it, the EOF processing would become
complicated, for not very much gain.

You can get around it by ensuring that you unset the variable before the
read, and check it after read returns EOF.  That will pick up any partial
lines.

FWIW, Posix and historical sh behavior require the trailing newline
delimiter.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
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]