LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 09: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, 08:43 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,790

Rep: Reputation: 292Reputation: 292Reputation: 292
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, 11: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:19 AM
Request for a simple net script edit <Ol>Origy Linux - Networking 0 06-03-2005 01:51 PM
request from every one the anti-riced General 3 04-21-2004 01:37 PM
greetings and request portable oxygen Linux - Software 6 10-07-2003 08:21 PM
strange request: script to track logged in time hamster Linux - General 3 05-08-2003 01:52 PM


All times are GMT -5. The time now is 09:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration