One of the arguments passed to the "plot" command has a trailing space following it. It's possible that this is being interpreted as part of the filename. Remove the trailing space and see if the behavior improves.
You use the construct "$PlotInputLoc/$PlotInputName-$i.$PNext
" many times. You may find it less error-prone (and more readable) to store this as a variable instead of copy/pasting the same thing over and over.
Also, your code that increments the i
variable is inside the script that gets passed to gnuplot. The bash variable i
in never being updated, so you'll loop continuously. Try swapping your EOF
and i=$(( $i + 1 ))
lines.