People (including me) sometimes want to pass arguments to a gnuplot script like
$ gnuplot script.gp arg1 anotherarg yetanother
Since gnuplot already has the "call" mechanism, I wish that mechanism be accessible from the command line in one way or another. For example, we could make
$ gnuplot --call script.gp arg1 arg2 arg3 #--(1)
$ gnuplot -e 'call "script.gp" arg1 arg2 arg3' #--(2)
There are a few reasons why (1) is better than (2).
Using shell variables is rather tedious with (2):
$ gnuplot -e 'call "script.gp" '$shelvar' '$shelvar2
(have I gotten it right?) and it's impossible (or tedious) to include blanks in the arguments. Imagine doing this
$ gnuplot --call script.gp "arg with blank" "arg with $shelvar"
in the style of (2).
Another reason why (1) (or something like that) is better is that it would become possible to write a gnuplot-script executable: Call this script "myplot.gp"
plot "$0" title "$1"
and then you could use it from the command line as
$ ./myplot.gp data1.dat "title of the plot"
Log in to post a comment.