3bd's webpage - - + { O 0 0 O } + - - Blog | Projects | Contact | About
________________________________________________________________________________
The new POSIX(R) tail is inasne(ly bad)
At the beginning, it was just the head utility, easy and simple;
print the first N lines (by default 10) and exit.
But most programmers and users wanted a way to reverse the operation
and print the last 10 lines instead, so the tail utility was created.
tail was as simple as head, but developers wanted more.
They added the -c option to print the last bytes of a file instead of lines.
They also added the -f option to continue reading *after* EOF.
If this was not enough complicated for a simple line-counting utility,
they also added the ability to use offsets from the start/end of the file;
e.g., "-n +10" to print every line after line number 10.
Current day tail.
Now we're at the current day; POSIX-1.2024, the waited one, has just released
publicly to the web. A lot of changes to utilities are made,
especially for pathnames. POSIX(R) now allows the utility to refuse
operations on paths containing a character.
Once I checked the head & tail utils, I found out they added
-c to head to print the first bytes instead of lines!
But they added a very weird thing to tail.
The -r to reverse output (the full file by default).
What? Why? And why in tail and not just create another utility for that job?
the tac utility already exist on most systems and does this exact job.
In the RATIONALE section, they stated that "more implementations that
have achieved POSIX certification had already implemented 'tail -r'
as an extension". One last thing, the -r option does not even
exist in GNU's tail nor in BusyBox's tail (the 2 most popular implementations)!
________________________________________________________________________________
Copyright (C) 2024 3bd <3bd3bdr@gmail.com>
Licensed under CC BY-SA