LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-10-2003, 08:46 AM   #1
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Rep: Reputation: 30
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
 
Old 09-10-2003, 07:43 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
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
 
Old 09-17-2003, 10:26 AM   #3
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
It worked. Thanks alot.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script request lgualteri Programming 7 06-17-2005 10:19 AM
Request for a simple net script edit <Ol>Origy Linux - Networking 0 06-03-2005 12:51 PM
request from every one the anti-riced General 3 04-21-2004 12:37 PM
greetings and request portable oxygen Linux - Software 6 10-07-2003 07:21 PM
strange request: script to track logged in time hamster Linux - General 3 05-08-2003 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration