Grabbing environment variables in gnuplot

set environment variables from bash e.g:

export positionsfile="$outputfile".positions
export rankprogressfile="$outputfile"

Then use them from gnuplot e.g.:

set size 1,1
set ylabel "Count"
set xlabel "Positions"

set terminal postscript eps color
set output "`echo $positionsfile`.eps"

plot "`echo $positionsfile`" using 1:2 with lines