Login or Register to Ask a Question and Join Our Community


Strange question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strange question
# 1  
Old 01-09-2006
Error Strange question

Good day.

I whant to put in a "readkey" function into my script. My script will be running in "real time". Basicaly I whant to add a eg. "Press X to exit" statement into my script. More or less like the read command, but I don't whant it to wait for the user to press enter. eg. Readkey. If no key is pressed then continuiu with the script, if a key is pressed, well use it or incorporate it in the main script.

Is there any tipe of thing like this, or am I going overboard with my scripting a bit?

And while U are reading this. Is there a place where I can post demo's of my scripts so that others can lean from them aswell.

Thanks.
# 2  
Old 01-09-2006
if u're using bash u can use

read -t 60 readkey

60 is in seconds
# 3  
Old 01-09-2006
Computer

Thanks will give it a try.

Appreciate it.
# 4  
Old 01-09-2006
You can post your solution so that others can learn.

From the archives... here is another possible solution.. It could be more than what you asked for...

making a .sh wait for user input

Vino
# 5  
Old 01-09-2006
Quote:
Originally Posted by ashterix
if u're using bash u can use

read -t 60 readkey

60 is in seconds
Cool question and a cool answer. I didn't know of this. Thanks to both of you. Smilie
# 6  
Old 01-09-2006
function getch {
stty raw
typeset x
x=`dd bs=1 count=1`
stty -raw
echo $x
}
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

strange problem

hello all, i am having problem in accessing a directory.I dont think its a permission issue.can anyone help me out. I am using korn sell code: $ ls -ltr sc* lrwxrwxrwx 1 essbase essbase 21 Oct 8 2010 sc_ssp -> /work/nfs/nas2/sc_ssp $ cd sc_ssp ksh: sc_ssp: not found $ (6 Replies)
Discussion started by: manid
6 Replies

2. UNIX for Dummies Questions & Answers

Question regarding strange FTP behaviour

Hello All, Have had an FTP transmission stop dead in its tracks this morning and the invoked shell script still running hours later. We have an FTP routine calls a remote site to deposit files on a daily basis. This morning the FTP didn't complete, but did connect to the remote service (as... (4 Replies)
Discussion started by: Cameron
4 Replies

3. Solaris

Strange Messages

Dear Solarizer, Every time i log in to the sheel i always got this messages, How to stop this messgaes permanently. tpx@plood/export/home/ $ Jul 29 11:35:00 plood sendmail: unable to qualify my own domain name (plood) -- using short name Jul 29 11:35:00 plood sendmail: unable to qualify... (3 Replies)
Discussion started by: tpx99
3 Replies

4. UNIX for Dummies Questions & Answers

Strange issue

I have created a server monitor program in Java that connects to servers via SSH and constantly refreshes the new server load every 3 mins. The problem is that even though it is a Java app running shell commands to get the load info, the commands still appear in 'history'. The question is.. is... (1 Reply)
Discussion started by: AndrewSH
1 Replies

5. Shell Programming and Scripting

strange cat question.

Does anyone know what the microprograms behind cat (and other commands) are like? In what language are those programs designed? Is their source available somewhere? No particular reason, just wondering. I know it's a bit strange... (3 Replies)
Discussion started by: sanchopansa
3 Replies

6. Solaris

Something strange...

Hi all, Thanks for any replies and for reading in advance. We have upgraded one of our database instances to 10g on a Solaris 8 box, anyhow the other day it started trying to ping loads of weird IP addresses that we don't use, since our systems all run on pretty similar IP's. It all behind... (0 Replies)
Discussion started by: B14speedfreak
0 Replies

7. Shell Programming and Scripting

Strange error.. help

Hi, When I give the following $ ps -ef | grep `echo $var1` | grep -v "grep `echo $var1`" | awk '{print $3}' | grep -v `echo $var1 80892 But when I give the following (made as command substitution) , I get error $var2=`ps -ef | grep `echo $var1` |... (2 Replies)
Discussion started by: preetikate
2 Replies

8. Post Here to Contact Site Administrators and Moderators

There is something strange with my account.

Whenever I see I post, I keep on seeing "IP: Logged" on the lower left-hand corner of the post (I do not click the logged link). And when I preview a user, I get "Administrative Options" on the bottom of the page. It is just strange that all of a sudden, I get these uneeded features. (1 Reply)
Discussion started by: Danny_10
1 Replies

9. UNIX for Dummies Questions & Answers

strange

Hi All I am doing a locate <file_name> on my Redhat 7 System. I am unable to get the output. All the keep getting is: locate: this is not a vlaid slocate database: /var/lib/locate/slocate.db What des this mean? Is my system compromised? Thanks in advance. KS (13 Replies)
Discussion started by: skotapal
13 Replies
Login or Register to Ask a Question

Featured Tech Videos