On Wed, Sep 11, 2002, Muli Ben-Yehuda wrote about "tail(1) and char device files":
> Perusing the tail source code shows that for files which are not
> regular files, tail just hordes up all output, until it runs out of
> memory or EOF is reached and only then it prints it. Does anyone know
> why it behaves this way for character device files and pipes? 

How would you want "tail" to behave?

Imagine you have a non-seekable file, but still a file that eventually
will end with an EOF (imagine, even, running tail without parameters and
it will be waiting for user input). Now, tail is suppose, when it ends
to print the last 10 lines (for example). How can it do that without
actually reading the entire input, always keeping the last 10 lines in
memory? There is no need to keep the entire input in memory, though -
only the last 10 lines read must be in memory at all times.

You're probably not interested in "tail"ing a non-seekable file, but rather
in "tail -f"ing it. In that case, forget about tail - use cat instead
(if you're looking for a "cat" that lseeks to the end of file first - well,
that's not what tail does...).


-- 
Nadav Har'El                        |    Wednesday, Sep 11 2002, 6 Tishri 5763
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Sign above a shop selling burglar alarms:
http://nadav.harel.org.il           |"For the man who has everything"

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to