LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-01-2012, 10:46 PM   #1
deeptisjains
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
Automating execution of commands inside a program


I have a program dnapars
I execute the program from command line as following:
./dnapars
The program then prompts me some message as a user menu from where I have to select a series of options in the order R U Y R. And then I copy the output file (outfile) in another result file.
I wrote the following script, but the execution hangs where it is supposed to execute the R option

for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
cp ../../../EditDistanceRandomParsimonator/RAxML_parsimonyTree.test4D20RI$i.0 intree
./dnapars
R <----- This doesn't execute
U
Y
R
cp outfile result$i
done

How can I make the script to run the options R U Y R under the dnapars program ?
 
Old 01-02-2012, 01:21 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello and Welcome to LinuxQuestions,

Have a look at expect. If you have it installed already you can start with the man pages:
Code:
man expect
If not, then have a look at Google, turns up tutorials like this one pretty fast.

Looking forward to your participation in the forums. Have fun with Linux.

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to give commands inside program sarathius Programming 2 04-28-2008 01:17 PM
automating standard commands at boot time Person_1873 Linux - Software 8 01-02-2008 09:13 AM
Automating modprobe commands rosspet Linux - Networking 4 08-06-2005 02:09 PM
execution of one program inside of another microsoft/linux Programming 2 03-18-2005 11:24 AM
Automating simple commands, scripting or programming? entob *BSD 3 09-01-2004 02:56 AM


All times are GMT -5. The time now is 03:37 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration