1

gnuplot shell variable substitution and arrays

view story
linux-howto

http://unix.stackexchange.com – I need to use shell variables in my gnuplot commands, for which I'm using the here document style. I also need to use loops inside the gnuplot code. Both these things are working. Now -- I want to use a gnuplot for loop's index to access a shell array variable. This is where I've been stuck all day. I have something like this: for ((i=0; i<=10; i++)) do var[$i] = i*10 done gnuplot<<EOF do for [j=1:10]{ #need to access ${var[j]} somehow val=sprintf("${var[%d]", j) ##doesn't work } EOF Individual access like ${var[1]} works. I suspect this may need using backquotes and/or expr, bu (HowTos)