Can I use a here document to pass a gnuplot script to gnuplot and also have commandline line arguments passed to gnuplot?
In my bash file, I would normally write:
#!/bin/bash
#set up code in here...
gnuplot -c script.gp $first $second
But I want to have everything in one bash file, so I've done
#!/bin/bash
#set up code in here...
gnuplot -c <<- EOF
do for [j=0:ARG1] {
do for [i=4:ARG2] {
plot '${data}' index j using 2:i with lp
}
}
EOF $first $second
but I get the infamous warning: here-document at line 87 delimited by end-of-file (wantedEOF')`` error. $data, $first, and $second are defined earlier in the bash script.
If I put the command line arguments on the next line, to leave the EOF alone, I get command not found errors associated with the value of $first.
My here document is indented only with tabs. There is no trailing whitespace.