Making Interactive program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making Interactive program
# 1  
Old 07-21-2006
MySQL Making Interactive program

Hi Friends

I am trying to make an interactive shell script ( I do not have expect tool )

My objective is

1.I have a progam named say "inter"
The program when ran on command prompt will be as below

Prompt>inter
Please enter the choice
1.enter 1
2.enter 2
< I need to enter 1 or 2 here >
output will be displayed in screen .

2.I want to make this automated , I want to run this once in 2 minutes and put the output in a file

Could any one give me some idea about how to go about this

Thanks
Siva
# 2  
Old 07-21-2006
Siva,

If you want to automate this process you need to use cron tab in UNIX. You can set it to run every 2 minutes everyday.
# 3  
Old 07-21-2006
Hi

Thanks for the reply

running it periodically is not a problem for me but my query is about making the script interactive

Thanks..Siva
# 4  
Old 07-21-2006
Are you using ksh?

Code:
select myoption in foo bar baz quux
 do
  print "You chose $REPLY."
  break
done

Yields:

Code:
1) foo      
2) bar      
3) baz      
4) quux     
#? 2        
You chose 2.
$

# 5  
Old 07-23-2006
Hi

Thanks for the responce

But I got to know the "here document" function which could solve my problem

The code looks like

inter << END
1
END

The output is

inter
1.enter 1
2.enter 2
1

and that is what I expected

Thanks
Siva
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues making SSH non-Interactive

I fire the rsyn command as below: rsync --delay-updates -F --compress --archive -e "/usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" user1@myhost.server.com:/tmp/jarexplorer-0.7.jar /web/admin/data/ The above command get interpreted as below: ssh -vvv -o... (4 Replies)
Discussion started by: mohtashims
4 Replies

2. Shell Programming and Scripting

Passing arguments to interactive program through bash script, here document

Dear Users, I have installed a standalone program to do multiple sequence alignment which takes user parameters to run the program. I have multiple sequence files and want to automate this process through a bash script. I have tried to write a small bash code but its throwing errors. Kindly... (13 Replies)
Discussion started by: biochemist
13 Replies

3. IP Networking

iptables (making a program)

Hey, I just got haxxord again on my Windows install, and im tired of it o_o Im gonna make a firewall blocking all IPs, allowing none. Then you access a web site/game/MSN/whatever, and it will ask "Do you want to allow this IP with this port?" I know the basics of the programming, but MY... (1 Reply)
Discussion started by: xulioz
1 Replies

4. Shell Programming and Scripting

Making a bash script and small C program for a homework assignment

Here's the assignment. I'll bold the parts that are rough for me. Unfortunately, that's quite a bit lol. The syntax is, of course, where my issues lie, for the most part. I don't have a lot of programming experience at all :/. I'd post what I've already done, but I'm so lost I really don't know... (1 Reply)
Discussion started by: twk101
1 Replies

5. Programming

Non-interactive login using C program in UNIX(Solaris)

Hi i need a c programm to login in unix(solaris). non-interactivley because it seems difficult to do it with unix shell scripting and passwd command cant be used and also i don't have expect installed and i am not allowed to installed expect in our servers. is there any c programm that can help... (1 Reply)
Discussion started by: munish259272
1 Replies

6. Programming

Run interactive program in background and grep it

I need to run an interactive program in the background so I can grep it for specific data to use for some logic in a script. There is no quiet or background mode on the program so I plan to redirect a document with commands in it and then to grep the output. This is almost working, except... (1 Reply)
Discussion started by: doonan_79
1 Replies

7. Shell Programming and Scripting

scripting an interactive program session

Hello, I'm looking to script the basic instant messaging program we have in my company, it's called "oi", it's working as follow: # oi $user then we have to launch it... after finding the system of the user it's asking for the message... then on a new line we have to hit ctrl+d I... (2 Replies)
Discussion started by: nomadvisuals
2 Replies

8. UNIX for Dummies Questions & Answers

Making a program compiled on Unix (HPUX) work on Linux

I am trying to make an application which works on unix to work on linux. I already tried copying the binary files and start it up but I am getting an error stating "Cannot execute binary file". Then I tried to recompile but i am getting an error whenever I tried to recompile. I am getting the... (1 Reply)
Discussion started by: khestoi
1 Replies

9. Shell Programming and Scripting

Develop Program with 'None Interactive Flag'

Hi I have created a program but am currently wondering how to develop it further. I wanted to know how i would go about developing the program further so that it is able to run with a "none interactive flag" enabling execution to be automated with the resultant file e-mailed to a user once a week.... (1 Reply)
Discussion started by: warlock129
1 Replies

10. Shell Programming and Scripting

Running an Interactive Program Remotely

now, i have a program that i would very much prefer to run remotely as i hate having to log into the box it is on. the problem is, every command i have tried to run this remotely doesn't work. the commands tries to kick off the program on the remote box but then hangs. like take for... (3 Replies)
Discussion started by: Terrible
3 Replies
Login or Register to Ask a Question