bug-coreutils
[Top][All Lists]
Advanced

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

bug#33281: head does not consume input after '-c' is satisfied


From: Luiz Angelo Daros de Luca
Subject: bug#33281: head does not consume input after '-c' is satisfied
Date: Mon, 5 Nov 2018 18:30:17 -0200

Hello,

Once head read enough bytes to satisfy -c option, it stops reading input
and quit.
This is different from what -n does and it is also different from both
FreeBSD and busybox head implementation.

With GNU Coreutils head:

$ echo -e "123\n456\n789" | { head -n 1; while read a; do echo "-$a-";
done; }
123
$ echo -e "123\n456\n789" | { head -c 4; while read a; do echo "-$a-";
done; }
123
-456-
-789-
$

With all other head implementations I tested:

$ echo -e "123\n456\n789" | { head -c 4 ; while read a ; do echo "-$a-" ;
done ; }
123
$

It would make sense to both -n and -c have the same meaning, differing only
whether to read bytes or lines.

Regards,
-- 

Luiz Angelo Daros de Luca
address@hidden


reply via email to

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