Bash scripting redirection issue
I compiled a program exec in c, and I've made some bash code to emulate a series of executions and place the output in some file. However it just interprets one execution and appends it 15 times to the outfile.
Code:
#!/bin/bash
count=15
while [ $count -gt 0 ]; do
./exec < infile.txt >> outfile.txt
let count=$count-1
done
The main program contains randomization of numbers based on the system, and it always yields the same set of random numbers in the outfile.
However when I provide the line './exec < infile.txt >> outfile.txt' to the command line multiple times the numbers are randomized as they should be.
How can I get it to interpret each execution separately and not just pass one execution 15 times into the outfile?
Cheers guys.