screen - tail box
From a shell script I would like to display the output of tail -f. While doing this, I want to restrict the output to the last 15lines of my screen only (and allow it to overwrite itself).
I thought of using curses to define my own window - however initscr() call wipes out the entire screen first.
The 'screen' utility looks promising, I can split the screen using Ctr+a S. However how do I do this programmatically while invoking screen itself?
I would like to invoke my main shell script as well as this 'tail box' (if I can call it that, without offending 'dialog' users)....
Any help is greatly appreciated!
How about something like
xterm -geometry 80x15 -e 'tail -f /var/log/yourfile'
The quotes on the command should not be there. The remainder of the command line after the "-e" is the command and the quotes turns the whole command into a single field. Also this solution does not restrict the output only to 15 lines as the scroll buffer is not set to 15 lines. The correct solution would be:
Originally Posted by theNbomr
The "-sl 15" sets the scroll buffer to 15 lines. For those not understanding the "-geometry 80x15" defines a window having 15 rows of 80 characters per row. Before KDE and Gnome, text based applications used the width and height in characters rather than in screen real estate sizes which was very nice and xterm is one of the oldest X applications.
xterm -geometry 80x15 -sl 15 -e tail -f /var/log/messages &
Other geometry options include placement information:
Note that the "+" can be a "-" for from bottom or right edges rather than from the top and left edges.
Also note that KDE and Gnome still have this options (which is slightly modified do that all applications use screen real estate width and heights and the format is changed.
Also note in all cases the +x+y can be used without the widthxheight portion.