shell脚本小数运算:
#!/bin/sh
i=0.01
b=0.3
d=1
#echo "$i +0.05" | bc
#i=$( echo "$i +0.05" | bc)
#echo "i=$i"
while [ "$d" -eq 1 ]; do
i=$( echo "$i +0.05" | bc)
echo "i=$i"
d=$( echo "$i <$b" | bc)
echo "d=$d"
done
exit 0
#!/bin/sh
i=0.01
b=0.3
d=1
while [ "$d" -eq 1 ]; do
ns rmac.tcl $i
awk -f delay.awk rate=$i rmac.tr >> delay
awk -f loss.awk rate=$i rmac.tr >> loss_rate
awk -f throughtput.awk rate=$i rmac.tr >> throughtput
i=$( echo "$i +0.05" | bc)
# echo "i=$i"
d=$( echo "$i <$b" | bc)
# echo "d=$d"
done
exit 0