On 7/4/06, Eben King <eben01@verizon.net> wrote:
> On Tue, 4 Jul 2006, Chuck Hast wrote:
>
> > I need to be able to send text out for a simple help system. What I need
> > is something that will read text down to some sort of break symbol or
> > group of symbols and then stop, prompt the user for a carrage return or
> > space or some other control character in order to send more text.
> >
> > I have tried less, more and the man pages reader, all work OK as long as
> > the request comes from a local connection, as soon as the connection to
> > the local device has to go through one or more nodes, (this is a packet
> > switch for a packet radio network) when any of the above sends text it
> > sends the whole thing, I think it is probably a issue with the handling of
> > the screens, but I need to be able to control the pagination on the text
> > file end, I tried the contols in less (-z and -y) but to no avail, I still
> > get the whole dump when I request the info.
> >
> > So I guess what I am looking for is a very dumb 'more' which allows me to
> > control the number of lines sent based on characters in the text file it's
> > self.
>
> Try this:
>
> #! /bin/bash
>
> textfile="$1"
> prompt="Press enter to continue: "
> my_tty=`tty`
>
> while read line ; do
> if echo "$line" | grep -q -e '^-$' ; then
> read -p "$prompt" junk < $my_tty
> echo
> else
> echo "$line"
> fi
> done < "$textfile"
>
> Invoke like so:
>
> dumb_more filename
>
> Have a line consisting only of a dash to pause. That bit about reading
> directly from the TTY may not work with your setup; dunno. I tried "while
> read line < "$textfile" ; do" but it would reread the first line every time
> through the loop.
>
>
Well, I thought it was going to work but then as soon as I did the test where
I connected to the system from a distant location I got the same thing the
whole file is dumped to me. For some reason when the file is read remotely
the pagination fails. It has to be a terminal thing, that is all I can
figure out.
-- Chuck Hast -- KP4DJT -- To paraphrase my flight instructor; "the only dumb question is the one you DID NOT ask resulting in my going out and having to identify your bits and pieces in the midst of torn and twisted metal." ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:33:36 EDT