I use wmii and this is the part of my script that updates the bar with the data:
echo -n "$WMII_NORMCOLORS" | wmiir create /rbar/10lte
while read line
do
echo "$line" | wmiir write /rbar/10lte
done
#here, touched up for your use with the ifconfig command
while sleep 1
do
ifconfig wwan0|awk '/bytes/ {print "RX: "$3,$4,"TX: "$7,$8}'|
sed 's/(//g; s/)//g' |
wmiir write /rbar/10lte
done