usr/lib/byobu/network: improve regex of the interface matching, which

was broken for device names >6 chars, LP: #509278
This commit is contained in:
Dustin Kirkland 2010-02-08 23:51:00 -06:00
commit 3f78ac2cc6
2 changed files with 4 additions and 2 deletions

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ byobu (2.56) unreleased; urgency=low
* debian/control: drop byobu-extras empty package
* usr/bin/byobu-launcher: fix recent regression, do exec byobu by default,
but allow for not exec'ing if ~/.byobu/disable-exec exists, LP: #519018
* usr/lib/byobu/network: improve regex of the interface matching, which
was broken for device names >6 chars, LP: #509278
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 06 Feb 2010 22:10:52 -0600

View file

@ -44,10 +44,10 @@ for i in up down; do
x1=`cat "$cache"` 2>/dev/null || tx1=0
if [ "$i" = "up" ]; then
symbol="^"
x2=`grep -m1 "\W$interface:" /proc/net/dev | sed "s/^.*://" | awk '{print $9}'`
x2=`grep -m1 "\b$interface:" /proc/net/dev | sed "s/^.*://" | awk '{print $9}'`
else
symbol="v"
x2=`grep -m1 "\W$interface:" /proc/net/dev | sed "s/^.*://" | awk '{print $1}'`
x2=`grep -m1 "\b$interface:" /proc/net/dev | sed "s/^.*://" | awk '{print $1}'`
fi
echo "$x2" > "$cache"
rate=`echo "$t1" "$t2" "$x1" "$x2" | awk '{printf "%.0f", ($4 - $3) / ($2 - $1) / 1024 }'`