-   Linux - Newbie (
-   -   Automating execution of commands inside a program (

deeptisjains 01-01-2012 09:46 PM

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 ?

EricTRA 01-02-2012 12:21 AM

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,


All times are GMT -5. The time now is 01:25 PM.