标签:#### free tar running ace color function ada avg
#!/bin/bash while true;do net=($(egrep -v "(lo|face|Inter-)" /proc/net/dev | awk -F ":" ‘{print $1}‘)) RTstart=($(egrep -v "(lo|face|Inter-)" /proc/net/dev | awk ‘{print $2,$10}‘)) sleep 1 clear RTstop=($(egrep -v "(lo|face|Inter-)" /proc/net/dev | awk ‘{print $2,$10}‘)) Rspeed=$(( ${RTstop[0]} - ${RTstart[0]} )) Tspeed=$(( ${RTstop[1]} - ${RTstart[1]} )) function speed(){ if [[ $1 -gt 1048576 ]];then speed=$(echo "scale=2; $1 / 1048576" | bc) echo -e "$2 : ${speed} M/s " elif [[ $1 -gt 1024 ]];then speed=$(echo "scale=2; $1 / 1024" | bc) echo -e "$2 : ${speed} K/s " else speed=$1 echo -e "$2 : ${speed} B/s " fi } echo "#################################" echo "#eth : $net" echo "#$(speed $Rspeed "Down")" echo "#$(speed $Tspeed "UP ")" echo "#RUNNING : $(uptime -s)" echo "#SINCE : $(uptime -p)" echo "#CPULoad : $(awk ‘{print $1,$2,$3}‘ /proc/loadavg)" echo "#$(free -h | awk ‘/Mem/ {print "MemUsed : "$3"/"$2}‘)" echo "#################################" sleep 4 done
标签:#### free tar running ace color function ada avg
原文地址:https://www.cnblogs.com/rockley/p/8782367.html