On 02/23/2011 11:58 AM, Bjartur Thorlacius wrote:
> % echo | head -n2 && echo bug
> bug
>
> This bit me when writing a line oriented prompter (which would `while
> head -n1`).
>
> FYI, this also applies to FreeBSD head.
That's because this is not a bug, but a POSIX requirement:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html
"When a file contains less than number lines, it shall be copied to
standard output in its entirety. This shall not be an error."
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc Description: OpenPGP digital signature