bareutils icon indicating copy to clipboard operation
bareutils copied to clipboard

Fix negative args and files without ending \n

Open E5ten opened this issue 6 years ago • 0 comments

To support negative arguments to -n like some other head implementations, mapfile the whole file to get the total length and if the arg is negative, make the lines printed the arg added to the file length. Don't remove trailing newlines with mapfile, and don't add them with printf, to avoid printing an extra newline when a file doesn't end with one.

E5ten avatar Oct 02 '19 02:10 E5ten