I think http://www.mail-archive.com/[email protected]/msg00253.htmlis
related. See also the thread there.

On Wed, Oct 13, 2010 at 3:50 PM, <[email protected]> wrote:

> Living in a mixed unix/linux/windows world, this has bitten me more than
> once:
>
>   $ /usr/bin/perl -e ' print "a b\nc d" ' | while read x y ;do echo
> "<$x><$y>" ;done
>   a b
>
> I can't see how it is not a bug to silently discard/ignore the non-empty
> data after the last newline in a file.
>
> Since this bug appears to have been present in ksh and bash since the
> time of Moses, so maybe it's too late to change the behavior.  However,
> I haven't found it documented anywhere; could this behavior at least be
> documented?
>
> On a related note, /usr/bin/wc -l has a similar bug where it counts
> newlines instead of "lines", causing it to miss counting the final line
> if it doesn't have a trailing newline character.  At least the -l option
> is documented as "counting newlines", even though the implications of
> that may be missed by a too hasty reader.
>
> _______________________________________________
> ast-developers mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-developers
>
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to