Make my script press buttons


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Make my script press buttons
# 1  
Old 12-12-2007
Make my script press buttons

I am having some problems trying to come up with way that my script can press <enter> for me.

I am surrounded by people who are not UNIX friendly, and I want my script to push Enter for me, without bothering the user to hit it.

Is that possible?
maybe with stty or something?

Been racking my brain on this, but can't figure it out. Any help is appreciated.
# 2  
Old 12-12-2007
Quote:
Originally Posted by Zelp
I am having some problems trying to come up with way that my script can press <enter> for me.
What is waiting for the <enter>?

Code:
echo "" | program-that-is-waiting-for-enter

or

Code:
program-that-is-waiting-for-enter <file-that-only-contains-a-newline

or

Code:
tell robotic-arm
     extend
     rotate left 90%
     down
     up
     rotate right 90%
     retract
end

# 3  
Old 12-12-2007
well nothing is actually waiting for it.

I have a huge "select do case" statement. and each time after chossing one of the options, I want to clear the screen and automatically hit <enter> again to show the select options.

kinda lame, and not exactly required, but I am sure the end user will be much happier with it.

so I am trying to put this at the end of each case choice.

Smilie that robotic arm would be cool too, but I don't have a spare lying around Smilie
# 4  
Old 12-12-2007
Quote:
Originally Posted by Zelp
I want to clear the screen and automatically hit <enter> again to show the select options.
Do you mean ksh's select? If so that is the thing that is waiting for <enter>.

I thought the menu was always displayed before the prompt....
# 5  
Old 12-12-2007
i guess the PS3 prompt is waiting.

Code:
PS3="Select the item number:"

because in a select command it just sits and wait for you to choose, so i want it to automatically hit <enter> right when it gets back to the PS3 prompt after completeing the previous selection. This way it displays the full list of choices again.
# 6  
Old 12-12-2007
Then do a break and get out then do the loop again...

Code:
while true
do
        PS3=......

        select ....... in .....
        do
               case "$REPLY" in ....
               ....
                      my long running thing
                      break;
               ....
               esac
        done
done

# 7  
Old 12-12-2007
This does display my options again for me, but how do I get out of the big loop now?

previously my lastcase choice was
Code:
"Exit") break;;

but now that too kicks me right back into my select options
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to detect key press in cgi shell script?

I want to detect key pressed in my .cgi web page, but it does not work even I found the code in other web site. My code is : #!/bin/sh #================================================= # PATH defination # ================================================... (2 Replies)
Discussion started by: Shuinvy
2 Replies

2. Shell Programming and Scripting

Press Any Key script sequence using bash - HELP

hi to all. im a newbie in unix shell scripts. i want to make a simple unix shell script using the bash shell that asks a user to press any key after a series of commands, or an x if he wishes to exit. here's a sample script that i made: #!/usr/bin/bash pause(){ /usr/bin/echo "\t\t Press... (3 Replies)
Discussion started by: booghaw
3 Replies

3. Shell Programming and Scripting

Bash script [Press Tab] Screen Blank..

Dear Member, OLD Question --> disable-completion not solved My bash Menu script ping process problem. If ping still running and users press SCREEN is Blank... Cant Members help me.. kill signal or others scripting for my case, btw i use Linux.. Thanks, Rico My Bash Script : ... (1 Reply)
Discussion started by: carnegiex
1 Replies

4. Shell Programming and Scripting

Trap key press in a script

How can I trap a character press in the shell script. For eg:- I have a script runinng a infinite loops , I will need to quit if q is pressed. I have seen the traping the signal , but they give option only for traping the defined interrupt signals. But those does not help me here. (3 Replies)
Discussion started by: praveenbvarrier
3 Replies
Login or Register to Ask a Question