LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 744|回复: 4

有谁能帮我看看为什么这个script不能在linux下用?[已解决]

[复制链接]
发表于 2004-3-23 07:56:44 | 显示全部楼层 |阅读模式
#!/bin/sh

plot=""
plot2=""

rm -f avg.tmp

outname=`echo $1 | sed -e "s/-/ /" | awk '{print $1}'`

# cycle through all filenames
until [ -z "$1" ]
do
  echo "processing $1"

  # grep only for the lines with ping data,
  # plot the field's we're interested in and
  # write to temp file
  MIN=`grep avg $1 | sed -e "s/\// /g" | awk '{print $7}'`
  AVG=`grep avg $1 | sed -e "s/\// /g" | awk '{print $8}'`
  PSIZE=`grep icmp_seq $1 | head -1 | awk '{print int($1)}'`
  echo "$PSIZE $AVG $MIN" >> avg.tmp
  grep icmp_seq $1 | sed -e "s/=/ /g" | awk '{print $6 " " $8 " " $1}' > $1.tmp

  #compose plot command for gnuplot
  plot="$plot \"$1.tmp\" u 1:2 not w l"
  plot2="$plot2 \"$1.tmp\" u 3:2 not w p"
  shift
  if [ -n "$1" ] ; then # no , after last file
      plot="$plot,"
      plot2="$plot2,"
  fi

done
sort -n avg.tmp > avg-sort.tmp

# plot the temp files with gnuplot
echo "set term png color; set output \"$outname-delay.png\"; set xlabel \"Time (s)\"; set ylabel \"Delay (ms)\"; plot $plot" | gnuplot - > /dev/null 2> /dev/null

echo "set term png color; set xlabel \"acket Size (bytes)\"; set ylabel \"Delay (ms)\"; set output \"$outname-scatter.png\"; plot \"avg-sort.tmp\" t \"avg\" w l -1, \"avg-sort.tmp\" u 1:3 t \"min\" w l -1, $plot2" | gnuplot - > /dev/null 2> /dev/null

echo "set term png color; set xlabel \"acket Size (bytes)\"; set ylabel \"Delay (ms)\"; set output \"$outname-min.png\"; plot \"avg-sort.tmp\" u 1:3 t \"min\" w l -1" | gnuplot - > /dev/null 2> /dev/null

# delete temp files
rm -f *.tmp
──────────────────────────────────────
但可以在solaris 5.9下用
谢谢!
发表于 2004-3-23 11:45:30 | 显示全部楼层

gnuplot - > /dev/null 2> /dev/null
改成
gnuplot -
试试。似乎你的 gnuplot 输入有问题。
发表于 2004-3-23 11:59:08 | 显示全部楼层
测了一下,在我的 debian 里,把
set term png color;
改成
set term png;
就可以了。
 楼主| 发表于 2004-3-23 18:58:17 | 显示全部楼层
多谢!!!!
发表于 2004-3-23 19:20:03 | 显示全部楼层
最初由 idkey 发表
测了一下,在我的 debian 里,把
set term png color;
改成
set term png;
就可以了。

多谢idkey兄帮忙 :thank
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表