Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-01-2012, 09:46 PM   #1
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:
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
cp ../../../EditDistanceRandomParsimonator/RAxML_parsimonyTree.test4D20RI$i.0 intree
R <----- This doesn't execute
cp outfile result$i

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

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

Have a look at expect. If you have it installed already you can start with the man pages:
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,



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

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration