variable line-display pager?

Thorsten Glaser tg at
Thu Feb 24 20:17:43 UTC 2011

Gary Kline <kline <at>> writes:

> For instance, say that my xterm/console/"Konsole" is 80x53 lines.
> My text file is around 200 lines long and I want to use more or less
> or some GUI pager to display only 15 lines at one time.  Tapping the 
> space bar would display another 15 lines and so on until EOF.  Is

mksh-current from CVS comes with a shell function called “smores”
which implements “something like” more(1) in (Korn) Shell. You’ll
need to press Return though, not Space, to go on.

If you replace the word LINES with 15 you get the behaviour you
want. The source is here (just look for “smores”):

If your mksh is “too old”, you’ll need to replace
		(( llen == -1 )) && llen=${#line}
(since “${%foo} = width of $foo in screen columns” got added
only recently, but “${#foo} = size of $foo in octets” has been
there for a while)

Note that, if you run smores as shell function, it’s aware of
whether your current locale is UTF-8 or not (use “set -U” to
enable UTF-8 mode, “set +U” to disable it, if you don’t want
that). This, again, only affects ${%line} calculation.

Yay for having to rewrite other people's Bash scripts because bash
suddenly stopped supporting the bash extensions they make use of
        -- Tonnerre Lombard in #nosec

More information about the freebsd-questions mailing list