You can inspect the command without executing it:
julia> scriptfile = "lineplot.gp";
julia> tmpfile = "/tmp/jl_XXXXXX";
julia> gp_args = ("pngcairo", "500", "500", "Verdana", "10", "output.png");
julia> cmd = `gnuplot -c $scriptfile $tmpfile $(map(x->string(x, " "), gp_args)...)`
`gnuplot -c lineplot.gp /tmp/jl_XXXXXX 'pngcairo 500 500 Verdana 10 output.png '`
Not good: many values will be passed to gnuplot as a single parameter: 'pngcairo 500 500 Verdana 10 output.png '
What you want is simply:
julia> cmd = `gnuplot -c $scriptfile $tmpfile $gp_args`
`gnuplot -c lineplot.gp /tmp/jl_XXXXXX pngcairo 500 500 Verdana 10 output.png`
This works because a collection (here gp_args) will be interpolated as a list of command parameters. See the documentation for details and examples.
Your first idea run(`gnuplot -c $scriptfile $tmpfile`, gp_args...) doesn’t work because command arguments must be part of the command object. It’s true that run accepts additional arguments but they are unrelated (the documentation could be improved in this regard).
Your second idea is… interesting
It’s basically doing this:
julia> `echo $(("a", "b")...)`
`echo ab`
What does it mean to splat values in $(...)? I’m not sure how this works… And the result is different from
julia> `echo $("a", "b")`
`echo a b`