LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-14-2008, 04:53 AM   #1
ksri07091983
Member
 
Registered: Nov 2007
Location: Chennai,TamilNadu,India
Distribution: RedHat,SuSE
Posts: 65

Rep: Reputation: 15
scripting help


Hi,

I am pasting my script below. This will randomly(?!) display an alphabet on the terminal.

Now i want to enhance this script with the following 2 feature

1). the script should take LINES and COLUMN variable from the shell variable $LINES & $COLUMNS

2). When the user presses the character which is displayed on the screen,the character should get vanished and the next character should start displaying from line 1.

can somebody help me out in this.

Thanks

Sridhar

##################### script ###################################
#!/bin/bash
variables(){
LINES=20
COLUMNS=125
x=0
y=`echo $RANDOM|cut -c1,2`
i=1
j=0
alphabets="abcdefghijklmnopqurstuvwxyz"
ti=`echo $alphabets|cut -c$i`
}
increment(){
if [ "$i" != 28 ]
then
if (( i % 2 ))
then
let i+=1
else
let i+=2
fi
else
i=1
fi
}

screen(){
while true
do
if [ "$x" != "$LINES" ]
then
clear
tput cup $x $y
ti=`echo $alphabets|cut -c$i`
echo $ti
sleep 1
let x+=1
else
let y=$y
let x=0
increment
ti=`echo $alphabets|cut -c$i`
clear
tput cup $x $y
echo $ti
sleep 1
fi
done
}
variables # setting the variables
screen # displaying the screen.

######################## end of script ########################
 
Old 04-14-2008, 04:57 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Is this a schoolwork (the two "features" would sound a lot like that)? If so, say it, and don't expect ready answers..

And if it's not, pardon me.
 
Old 04-14-2008, 05:15 AM   #3
ksri07091983
Member
 
Registered: Nov 2007
Location: Chennai,TamilNadu,India
Distribution: RedHat,SuSE
Posts: 65

Original Poster
Rep: Reputation: 15
Hi,

That my curiosity to simulate some games (which i seen work in windows) in linux shell using the scripting technique.

S u can can call it as a schoolwork ..coz im still a learner

Thanks

Sridhar
 
  


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
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM
on scripting gigsz Linux - Newbie 5 12-27-2005 02:24 AM
Need help scripting Tamara Programming 7 06-06-2005 02:06 AM
Scripting Help Please Jazinator Linux - Newbie 7 10-17-2004 06:35 PM
Scripting help markelo Programming 6 07-29-2004 11:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:05 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