following up from the question on SO about command line parameters to gnuplot scripts, and its corresponding answer, I see that I can make a script myscript.gp like
if(!exist("parameters")) parameters=""
plot "< myprog ".parameters u 1:2
and call it with
$ gnuplot -e "parameters='-m 5'" myscript.gp
However, I could achieve a similar result when running in interactive mode with myscript2.gp as
parameters="$0"
plot "< myprog ".parameters u 1:2
and calling it from the interactive prompt as
gnuplot> call "myscript2.gp" "-m 5"
And now the question. As I see it those two methods are not connected and the $O would fail when when running in batch, whereas the 'parameters' is not updated when using call.
How do I set a script which could be called from the shell command line AS WELL AS from the gnuplot interactive command line? Another way to ask it, is it possible to test in which conditions was the script called?
Thanks,