好的,我正在尝试为一组不同的数据文件(总共 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