gnuplot 4.7 from CVS 2013-07-21.
I am using a bash here document (the << EOF
construct) to pass input to a gnuplot script, as shown in the MWE below. Call it with the name of an empty file as parameter.
The script produces the error message
more> do for [count=0:nsteps] {; @DOPLOT
^
line 0: invalid character @
line 0: Unexpected }
My current workaround is to use eval, however, it would be nice to understand what's going on. I might need to escape the at character @
but had no luck with google.
Interestingly, putting the macro invocation right after the open curly bracket {
works.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Thank you for the bug report.
I do not entirely understand why this problem is triggered by wrapping the commands in a shell script but not triggered when they are simply placed in a *.gp input file. Nevertheless, the failure mode is clear. In general input commands are assembled by reading 'enough' input to complete a command and then interpreting it. Macro substitution is done as the first step in interpretation. But in some cases, including the one you ran into, during interpretation the program discovers it has to extend the command by reading in additional lines of input. Unfortunately it was failing to re-check for macros in the new part of the extended command.
Now fixed in CVS for 4.7
The 4.6 source will need a similar fix before release of 4.6.4