view Paper/log/calc_avg.sh @ 55:307c87617e62 default tip

add slide
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Wed, 11 Sep 2013 10:21:42 +0900
parents 8bd559e6d4f7
children
line wrap: on
line source

#!/bin/sh

function average() {
 total=0.0
 count=0
 while read time
 do
  total=`echo $total + $time | bc`
  count=`echo $count + 1 | bc`
 done
 avg=`echo "scale=4;$total/$count" | bc`
 echo "$count,$avg"
}

for arg in $@
do
 average < $arg
done