The following is a script I wrote to run an executable ./runnable on arguement/input file input. It takes standard from another file called finalfile and outputs it to a file called outfile. There are 91 lines in finalfile (i.e 91 different standard space delimited inputs) and therefore the bash script should call the ./runnable input 91 times. But, I am not sure why is it calling it only one time. Any suggestions on whats going on wrong? I am new to bash scripting and ergo not very good. Kindly be explanatory. Thanks!
#!/bin/bash
OUTFILE=outfile
(
a=0
while read line
do
./runnable input
echo "This is line number: $a"
a='expr $a+ 1'
done<final_file
) >$OUTFILE
To clarify the finalfile looks like
_ DATA _
2,9,2,9,10,0,38
2,9,2,10,11,0,0
2,9,2,11,12,0,0
2,9,2,12,13,0,0
2,9,2,13,0,1,4
2,9,2,13,3,2,2
and so on. One line ,at a time, is the standard input. Number of lines in finalfile correspond to number of times the standard input is given. So in the above case script should run 6 times as there are six lines.