I need to write a shell script to automatically run a set of files through an existing program ~1000 times. The program I'm trying to run them through is accessed through command line as follows, then you load the files you want the program to use by typing in "load filetype filename" as follows:
server>./fbat
*******************************************************
* *
* ********* * * * * ********* *
* * * * * * * *
* ******* * * * * * * *
* * * * * *** * * *
* * * * * * * *
* * * * * * * * *
* *
* Xin Xu C1999-2009 v2.0.4Q *
* Program for Population Genetics *
* Harvard School of Public Health *
* *
*******************************************************
>>load map leprmap.txt
read in 899 markers' info
>>load ped leprped.txt
read in: 899 markers from 16 pedigrees (338 nuclear families,1182 persons)
>>load phe phe_dbpsim2e1.txt
1 quantitative traits have been successfully read
719 persons have been phenotyped
>>trait resid
affection resid**
>>fbat -v1 -e
(...lots of output here)
The file that will change with each run is phe_dbpsim2e1.txt
, the name of which increments by one number each run. I'm able to execute the program from a script, but once the program is open, it doesn't recognize any of the commands I am trying to input through the script (i.e. load) and the program waits for me to manually input commands. Once I quit the program, all of my commands from the script show up on the screen, so it seems like the script I wrote is paused while the program is open.
Is there a way to input commands into the program once it's open without typing them in by hand?
echo "load map leprmap.txt" | ./fbat
? Do you need to runfbat
once, with 5000 commands sent to it? Or do you need to run it 1000 times, with five commands each time? You say “a set of files”, but you also say “the name … increments by one … each run”, which are not the same thing.