我需要使用bash脚本生成图形gnuplot,因为我有多个要绘制的文件。
while [ $j -lt 30 ];
do
if [ -f ./MyFile[$j] ]; then
load 'Plot_Histogramma.plt'
fi
j=$(( $j + 1 ))
done
内部" Plot_Hisogramma.plt"我有
set output "MyFile[$j].eps"
plot "./MyFile[$j]" using 2:1 title "MyTitle" with boxes ls 7 lc rgb "blue"
所以我需要一个方法将我的索引变量从脚本传递给gnuplot。我尝试使用echo
,printf
并导出,但也许,我做错了。
答案 0 :(得分:0)
我想你可能错误地认识了这个阵列:
while [ $j -lt 30 ]; do
if [ -f ./${MyFile[$j]} ]; then
load 'Plot_Histogramma.plt'
fi
j=$(( $j + 1 ))
done
然后我认为另一个脚本应该是这样的:
set output "${MyFile[$j]}.eps"
plot "./${MyFile[$j]}" using 2:1 title "MyTitle" with boxes ls 7 lc rgb "blue"
也许这个链接可以帮助:bash: loading presaved variable to gnuplot cmd load