Re: [SLUG] Need Text reader

From: Eben King (eben01@verizon.net)
Date: Tue Jul 04 2006 - 13:01:23 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:
>>
>> > 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?
>>
> Here is what it looks like when I am on the console of the machine that I am
> working on
>
> This is just the first piece up to the break:
>
> ===========begin dump ============
>
...
>
> NOTES:
> TPALAN is in the process of gathering equipment to convert this switch
> to FPAC Linux.
>
> Press enter to continue:
>
> ==============end of dump ===============
>
> Now I will show you a partial screen of the same file when requested as
> though I was a remote user on the network trying to get info on that part-
> cular switch, in this case I have connected to a switch in Paris, France
> and then issued a connect back to the test switch. Once at the command
> prompt I type the 411 command and get the whole file dumped I will send
> you the upper part of the file along with the link setup info:
>
>
...
>
> NOTES:
> TPALAN is in the process of gathering equipment to convert this switch
> to FPAC Linux.
>
> ========== end dump ============
>
> There should have been a prompt between Linux and KP4DJT, but there
> is nothing and it just dumps the whole thing.

So it doesn't detect the dash line when running remotely. Hmm. Maybe the
transmission modifies the line ending, or does something funny with dash
lines? Well, just for testing, make a file with the line "ZYXWV", change
the script to

if echo "$line" | grep -q -e '^ZYXWV' ; then

and see if it works then. The failure I had expected was /dev/console not
working, so you'd pound on "enter" to no avail.

Also did you try "more -24 filename"? Might need a "TERM=dumb" in there
too.

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

Hi! I'm a .sig virus! Copy me to your .sig! ----------------------------------------------------------------------- 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:34:06 EDT