Hi guys,
Will keep this short and sweet. Trying to do integer devision to *decimial places but i dont think the version of ksh installed on solaris 10 supports this as they would need to be declared as floats. Is this correct?
If there isnt a way of doing it with ksh is there another way to do it
integer rBytes=`kstat -p -c net -n $Interface -s rbytes64 1 2 |\
tail -1 | awk '{print $2}'`
integer oBytes=`kstat -p -c net -n $Interface -s obytes64 1 2 |\
tail -1 | awk '{print $2}'`
integer read=$(($rBytes/1000000))
integer write=$(($oBytes/1000000))
k=k+1
echo "rBytes=$rBytes oBytes=$oBytes"
echo "read=$read Mbps write=$write Mbps"
Gives the output:
rBytes=694127 oBytes=769020
read=0 Mbps write=0 Mbps
rBytes=17061 oBytes=141840
read=0 Mbps write=0 Mbps
Whereas it should give:
rBytes=694127 oBytes=769020
read=0.69 Mbps write=0.76 Mbps
rBytes=17061 oBytes=141840
read=0.17 Mbps write=0.14 Mbps