header(){
cat - <<!
<html>;
<body>;
<table width="95%" border="1" align="center" bordercolorlight="#FFCCCC" bordercolordark="#FF6633">;
<CAPTION>;<FONT SIZE=+2>;<b>;${bname}</b>;</FONT>;</CAPTION>;
<tr align="center" valign="middle">;<font face="宋体">;
<td rowspan=2>;<font size=2>;VPS</font>;</td>;
<td colspan=7>;<font size=+2>;原始数据(onstat -g glo)</font>;</td>;
<td colspan=6>;<font size=+2>;资源利用率(%)</font>;</td>;
<td colspan=5>;<font size=+2>;累计利用量(秒)</font>;</td>;
</tr>;
<tr align="center" valign="middle">;<font size="1">;
<td>;A</td>;
<td>;B</td>;
<td>;C</td>;
<td>;D</td>;
<td>;E</td>;
<td>;F</td>;
<td>;G</td>;
<td>;时段一</td>;
<td>;时段二</td>;
<td>;时段三</td>;
<td>;时段四</td>;
<td>;时段五</td>;
<td>;时段六</td>;
<td>;200秒</td>;
<td>;300秒</td>;
<td>;400秒</td>;
<td>;500秒</td>;
<td>;600秒</td>;
</tr>;
!
}
tailer(){
D=`date +%Y/%m/%d-%H:%M`
cat - <<!
</table>;
<p>;<font size="1">;Report Date:${D}</font>;</p>;
</html>;
!
}
# program main body
getdata >;$GLODAT
header >;$tdir/$bname.html
body >;>;$tdir/$bname.html
tailer >;>;$tdir/$bname.html
rm -rf ${TMP}
输出样例
文章来源于领测软件测试网 https://www.ltesting.net/