Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ########################
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.