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.
-- A well-loved and correctly trained domestic canine is generally slobbery, excitable, noisy, scatalogically obsessed, xenophobic, pathetically unjudgmental, embarrassingly uninhibited, unreasoningly devoted, heartbreakingly dependent and wretchedly craven. - PB, AFCA ----------------------------------------------------------------------- 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:24 EDT