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

 
echo listobjects=$listobjects
echo logfile=${logfile}

dos2unix ${performanceLog} &> /dev/zero

# get the performanceLog row number 
trac_rows=`sed -n '$=' ${performanceLog}`
# echo trac_rows=$trac_rows


i=1
while [[ $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 support
	max=0.0;
	for value in $content ; do
		max=`echo "if($value < $max) print "$max" else print "$value"" | bc`
    done
	
	echo "max is $max."
	
	i=$((i+1))
}
done

你可能感兴趣的:(unix,shell,dos,processing,float)