1

In a bash script I have several arrays which I need to access in a gnuplot code:

#!/bin/bash
...
# fill array a[*] and b[*]
...
gnuplot <<EOF
  do for [j=0:10] { # access ${a[j]} and ${b[j]} }
EOF

The problem is that ${a[j]} in the gnuplot code is not interpreted as element j of the array a.

How can I solve that?

thyme
  • 111
  • 2
  • I assume your she-bang line is a copy/paste typo for '#!/bin/bash' ? – Jeff Schaller May 03 '16 at 11:24
  • No, it was a real typo ;-) Anyway the code is just an example, and the problem remains... – thyme May 03 '16 at 11:30
  • 1
    Possibly related: [gnuplot shell variable substitution and arrays](http://unix.stackexchange.com/questions/52453/gnuplot-shell-variable-substitution-and-arrays) – steeldriver May 03 '16 at 13:28

0 Answers0