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
luizl...@gmail.com

Reply via email to