Passing gnuplot variables to shell script

Hi,

I need to pass a gnuplot value to a shell script. I have a main shell script (Main.sh) that has a bunch of gnuplot commands. Main.sh calls another gnuplot script (Child.gnu). A part of the code in Child.gnu is as follows:

sp '</data/src/scripts/results/plot_data.sh $col' u (A):2:3 w pm3d
col = col + 1
if (col<total_columns) reread

The splot command (sp) calls another shell script call plot_data.sh and needs the variable "col" for further processing. the variable "col" is incremented by Child.gnu. I do not seem to be able to pass the value of "col" to plot_data.sh. I tried using "col and "$col" both don't work. Pls. help!!!!

Thanks

In what way does it "not work"? Does the script get no arguments at all, or does it just see col instead of col's value? Or is the script not run at all?

Try putting that block in double-quotes instead of single-quotes.

No netspeak please.

Sorry about the netspeak Corona. Will try and avoid it the best that I can :slight_smile:

If I use "$col" no arguments are passed to the script. If I use "col", I see "col" instead of its value. I tried using double-quotes but that did not make any difference either.

Thanks

Ahah! It doesn't use $ for that in quotes. Try \col. Bizzare but seems to work for me.

\col passes "col". Keep in mind that this is a gnuplot script and I need to pass the value from gnuplot to shell.

Thankyou.

Yes, I am aware this is a gnuplot script and did a lot of testing. Sorry it doesn't work for you. I haven't seen this < syntax you're using and can't find it in any manual.

Thank you for all the effort Corona. I was trying to plot a wall chart, I was referencing some of the stuff found at : Gnuplot tricks: Return of the wall chart - entirely in gnuplot

I don't see that < syntax you're using in there anywhere either.

Sorry, my mistake, wrong link. Here it is: Gnuplot tricks: Making a ribbon chart in gnuplot