LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Challanging Script Request (https://www.linuxquestions.org/questions/linux-software-2/challanging-script-request-91225/)

dolvmin 09-10-2003 08:46 AM

Challanging Script Request
 
Okay... Here it is.

I need a script for my game server. I'm a perfectionist. I can't stand having to reopen another terminal so I would like to know if there is a way to get this going.

I have a script that loops while using the "cat <filename>" every "sleep 5". I want to set it up so I can enter a key stroke to quit the script. My current problem is, using "read VARIABLE" works much like pause. That is a NO NO! heh. Someone help me out here plz? Here's the script.

#! /bin/bash
# Chris Jepson
# 09-10-03
# /home/c/NeverwinterNights/nwn/status.dat ./c... "FAT32"
# Program < server.exe
# This file is designed to emulate real-time refreshment of the log file.

FILE=/home/c/NeverwinterNights/nwn/status.dat
MAIN=/home/c/NeverwinterNights/nwn/server.exe
LOG=/home/c/NeverwinterNights/nwn/logs.0/nwserverLog1.txt


LOOP=1
PAUSE=""

clear

while [ "$LOOP"!=0 ]

do

tput cup 0 0; cat $LOG


tput cup 0 0; echo " ______________________________________________________________________________ "
tput cup 1 0; echo "| Neverwinter Server Status |"
tput cup 2 0; echo "| ------------------------- |"
tput cup 3 0; echo "| *** Use (Ctrl + C) to quit! *** |"
tput cup 4 0; echo "|______________________________________________________________________________|"
tput cup 5 0; echo "| |"
tput cup 6 0; echo "| |"
tput cup 7 0; echo "| |"
tput cup 8 0; echo "| |"
tput cup 9 0; echo "| |"
tput cup 10 0; echo "|______________________________________________________________________________|"

sleep 4
clear

done

# EOF

jailbait 09-10-2003 07:43 PM

Put this statement as the first statement in the script:
trap "echo 'exiting on ctrl-c'; exit " 2

and assuming that I have the syntax correct your script should quit on ctrl-c

dolvmin 09-17-2003 10:26 AM

It worked. Thanks alot.


All times are GMT -5. The time now is 05:15 AM.