【发布时间】:2012-11-13 17:47:48
【问题描述】:
好的,我正在尝试为一组不同的数据文件(总共 9 个)绘制图表,所以我创建了这个 shell 脚本:
!/bin/bash
datastorenum=9
PlotOutputLoc=/root/bin/SANscripts/graphs
PlotGname=datastore
Pfext=png
PlotInputName=desktop
PNext=dat
PlotInputLoc=/root/bin/SANscripts/inputdata
write_plotgraph()
{
i=1
while [ $datastorenum != $i ]
do
gnuplot <<- EOF
set term png large size 1200,1024
set output "$PlotOutputLoc/$PlotGname-$i.$Pfext"
set xdata time
set timefmt '%H:%M'
set style data lines
set ylabel "IOs-Avg-%-kb"
set ytics 50
set autoscale
set xlabel "Hour"
plot "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:2 title "Total IOs", "$PlotInputLoc/$PlotInputName-$i.$PNext " using 1:3 title "Read %", "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:4 title "CacheHit %", "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:5 title "Current Kb/sec", "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:6 title "Maximum Kb/sec", "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:7 title "Current IO/sec", "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:8 title "Maximum IO/sec"
i=$(( $i + 1 ))
EOF
done
}
write_plotgraph
它不工作exaclty我得到一堆这个:
line 0: warning: Skipping unreadable file "/root/bin/SANscripts/inputdata/desktop-1.dat "
line 0: warning: Skipping unreadable file "/root/bin/SANscripts/inputdata/desktop-1.dat "
line 0: warning: Skipping unreadable file "/root/bin/SANscripts/inputdata/desktop-1.dat "
感谢您的帮助
好的,如果我想传递另一个函数呢?我喜欢这个函数只绘制totalio?
write_plotTios()
{
i=1
while [ $datastorenum != $i ]
do
gnuplot <<- EOF
set term png large size 1200,1024
set output "$PlotOutputLoc/$PlotGname-$i-$TIOS.$Pfext"
set xdata time
set timefmt '%H:%M'
set style data lines
set ylabel "IOs-Avg-%-kb"
set ytics 50
set autoscale
set xlabel "Hour"
plot "$PlotInputLoc/$PlotInputName-$i.$PNext" using 1:2 title "Total IOs"
EOF
i=$(( $i + 1 ))
done
}
write_plotTios
这不起作用,我收到一条错误消息:
/plot_datastore1t.sh: line 54: warning: here-document at line 37 delimited by end-of-file (wanted `EOF')
./plot_datastore1t.sh: line 55: syntax error: unexpected end of file
【问题讨论】:
-
都是
desktop-1.dat吗? -- 另外,gnuplot 是什么版本? -
没关系我必须从 EOF 中删除它现在可以使用的空格
标签: shell gnuplot scripting-language