|
Description from man page: pw stands for Pipe Watch. This is a utility which continuously reads textual input from a
pipe or pipe-like source, and maintains a dynamic display of the most recently read N
lines.
If pw is invoked such that its standard input is a TTY, it simply reads lines and prints
them in its characteristic way, with control characters replaced by caret codes, until
end-of-file is encountered. Long lines aren't clipped, and there is no interactive mode.
The intended use of pw is that its standard input is a pipe, such as the output of another
command, or a pipe-like device such as a socket or whatever. In this situation, pw ex-
pects to be executed in a TTY session in which a /dev/tty device can be opened, for the
purposes of obtaining interactive input. The remaining description pertains to this in-
teractive mode.
In interactive mode, pw simultaneously monitors its standard input for the arrival of new
data, as well as the TTY for interactive commands. Lines from standard input are placed
into a FIFO buffer. While the FIFO buffer is not yet full, lines are displayed immedi-
ately. After the FIFO buffer fills up with the specified number of lines (controlled by
the -n option) then pw transitions into a mode in which, old lines are bumped from the
tail of the FIFO as new ones are added to the head, and refresh operations are required in
order to display the current FIFO contents.
The display only refreshes with the latest FIFO data when
1. there is some keyboard activity from the terminal; or
2. when the interval period has expired without new input having been seen; or else
3. whenever the long period elapses.
In other words, while the pipe is spewing, and there is no keyboard input, the display is
updated infrequently, only according to the long interval.
The display is also updated when standard input indicates end-of-data. In this situation,
pw terminates, unless the -d (do not quit) option has been specified, in which case it pw
stays in interactive mode. The the end-of-data status is indicated by the string EOF being
displayed in the status line after the data.
|