Re: [SLUG] Need Text reader

From: Eben King (eben01@verizon.net)
Date: Tue Jul 04 2006 - 11:30:53 EDT


On Tue, 4 Jul 2006, Chuck Hast wrote:

> 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.
>>
>> 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"
>
> 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.

Huh. That's a failure mode I hadn't anticipated. Is it printing the prompt
at appropriate places? What file are you using to test it?

-- 
-eben   QebWenE01R@vTerYizUonI.nOetP   royalty.no-ip.org:81

Drive nail here > < for new monitor. ----------------------------------------------------------------------- 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:43 EDT