I hate shell scripts, but here goes...
Most of this is pulled from the link Bazzy gave, so Bazzy++.
1 2 3 4 5 6 7
LIMIT=1000
for ((a=1; a <= LIMIT ; a++)) # Double parentheses, and "LIMIT" with no "$".
do
./prog $a > output$a.txt # read below
done # A construct borrowed from 'ksh93'.
I'm not entirely sure that's correct. It may be more like output'$a'.txt. Notice the single quotes around $a. But even that I'm not sure of. As I said, I hate shell scripting. People say it's easy, but to me it looks dirty, awkward, and clumsy. If you're the one who wrote the program, why not just make IT do all this work?