I have a script file that contains different case IDs of a factorial Design of Experiment (DoE). I also have a script file run on MATLAB. I am attempting to run multiple cases of this DoE at once, 25 to be exact, and only up to 25 at once. The current input to the ssh server looks like the following (the batch file):
InputFile=inputfile.txt
count=0
while read -r case; do
echo $case
nohup matlab -nodisplay -nodesktop -r "try;runinput=$case;matlab_script;end;exit"
((++count % 25 == 0)) && wait
done <"$InputFile"
This however, only reads the first line of the inputfile.txt and runs that, and does not run the other 24 processes at the same time. I have tried getting rid of the && wait part but it still doesn't do what I want. How can I make it start the 24 other jobs in parallel?