在shell中利用 bc 实现小数或者整数的比较操作

来源:互联网 发布:南宁的淘宝实体店 编辑:程序博客网 时间:2024/06/06 05:18
 
echo listobjects=$listobjectsecho logfile=${logfile}dos2unix ${performanceLog} &> /dev/zero# get the performanceLog row number trac_rows=`sed -n '$=' ${performanceLog}`# echo trac_rows=$trac_rowsi=1while [[ $i -le $trac_rows ]]; do{content=`sed -n ''$i''p ${performanceLog}`echo "processing($i/$trac_rows): current content=$content"# both of integral number and float value can be supportmax=0.0;for value in $content ; domax=`echo "if($value < $max) print "$max" else print "$value"" | bc`    doneecho "max is $max."i=$((i+1))}done

来自:http://www.verydemo.com/demo_c170_i5775.html

0 0
原创粉丝点击