Call site MYFILE = "script1.gp" FUNC = "sin(x)" call MYFILE FUNC 1.23 "This is a plot title" Upon entry to the called script ARG0 holds "script1.gp" ARG1 holds the string "sin(x)" ARG2 holds the string "1.23" ARG3 holds the string "This is a plot title" ARGC is 3 The script itself can now execute plot @ARG1 with lines title ARG3 print ARG2 * 4.56, @ARG2 * 4.56 print "This plot produced by script ", ARG0
Notice that because ARG1 is a string it must be dereferenced as a macro, but ARG2 may be dereferenced either as a macro (yielding a numerical constant) or a variable (yielding that same numerical value after auto-promotion of the string "1.23" to a real).
The same result could be obtained directly from a shell script by invoking gnuplot with the -c command line option:
gnuplot -persist -c "script1.gp" "sin(x)" 1.23 "This is a plot title"