Re: Controlled exit from 'tail -f' within a shell script

From: Robert Bardos (Robert.Bardos@ZUGERKB.CH)
Date: Tue Jun 25 2002 - 10:04:10 EDT


Yep, it does. Thanks to all who replied. A beginner's mistake: I had issued
trap from the command prompt, thinking it would be inherited by the script.
Should have had the word 'shell' in mind ...

Thanks again
Robert

> -----Ursprüngliche Nachricht-----
> Von: Bill Verzal [SMTP:Bill_Verzal@BCBSIL.COM]
> Gesendet am: Dienstag, 25. Juni 2002 13:43
> An: aix-l@Princeton.EDU
> Betreff: Re: Controlled exit from 'tail -f' within a shell script
>
>
> trap should work fine. What was your syntax ?
>
> --------------------------------------------------------------------------
> ---------------------------------
>
> Bill Verzal
> Technical Consultant
> Forbes Technical Consulting
> (312) 653-3684
> bill_verzal@bcbsil.com
>
>
>
> Robert Bardos
> <Robert.Bardos@Z To: aix-l@Princeton.EDU
> UGERKB.CH> cc:
> Sent by: IBM AIX Subject: Controlled exit
> from 'tail -f' within a shell script
> Discussion List
> <aix-l@Princeton
> .EDU>
>
>
> 06/25/2002 06:44
> AM
> Please respond
> to IBM AIX
> Discussion List
>
>
>
>
>
>
> Hi all,
>
> I am new to this list (and new to AIX, new to shell scripts ....) so
> please
> bear with me.
> My intention is to provide our operators with a simple, telnet based tool
> that allows them to start/stop some subsystems and to watch these
> subsystems' logs continuously. And: as an exercise for myself I want to do
> it all with shell scripts.
>
> So basically the logic is:
>
> do while true
> echo selection screen
> read user_selection
> case "$user_selection" in
> x) tail -f my_log_file
> .....
> esac
> ....
> done
>
> According to the man(ual) and some tests 'tail -f' can only be ended by
> pressing ctrl-c.
> This also cancels my shell script which is not the desired effect. (I
> experimented with the trap command but to no avail). Any idea how I can
> limit ctrl-c to just the 'tail -f' command?
>
> Should there be a more appropriate list for this kind of question then
> please advise.
>
> Thanks in advance
> Robert
> (See attached file: InterScan_Disclaimer.txt)
> << Datei: InterScan_Disclaimer.txt >>





This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:00 EDT