This is a followup of my earlier question here: "gnuplot bashshell to plot several curves in one window" which Christoph kindly helped with it. However, I had simplified my question assuming I would be able to advance from there on my own. No need to say, I couldn't! :( what I really want to plot in one fig frame is a set of data files and for each of the data files a curve(exponential function) fitted to it. Unfortunately I'm stuck with gnuplot 4.2 which doesn't allow me to use for loop and iterations. I would greatly appreciate any advice. The following bash cript prints nine curves and their fitted lines on separate files.
#!/bin/bash
for Counter in {1..9}; do
FILE="dataFile"$Counter".data"
gnuplot <<EOF
set xlabel "k"
set ylabel "p(k)"
set term png
set output "${FILE}.png"
title_fexp(a,b) = sprintf('exp(x) = %.2f * e(%.2f)', a, b)
expon(x) = c * exp(-x*d)
fit [10:100] expon(x) '${FILE}' via c,d
plot [1:50] expon(x)t title_fexp(c,d), '${FILE}'
EOF
done