* bin/ip_address, bin/mem_used, bin/temp_c, bin/temp_f,

bin/wifi_quality: performance improvements, reduce the number of
    forked shells by multiple sed-calls on one line by using a single
    sed call with multiple -e arguments (thanks for the suggestion smoser)


Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-08-17 14:24:27 -05:00
commit e9ecd3b97e
6 changed files with 13 additions and 9 deletions

View file

@ -20,7 +20,7 @@
PKG="byobu"
if [ "$1" = "--detail" ]; then
/sbin/ifconfig | grep "inet addr" | sed 's/^\s*//' | sed 's/\s*$//'
/sbin/ifconfig | grep "inet addr" | sed -e 's/^\s*//' -e 's/\s*$//'
exit 0
fi
@ -36,6 +36,6 @@ else
interface=`tail -n1 /proc/net/route | awk '{print $1}'`
fi
ipaddr=`/sbin/ifconfig "$interface" | grep "inet addr:" | sed "s/^.*inet addr://" | sed "s/ .*$//"`
ipaddr=`/sbin/ifconfig "$interface" | grep "inet addr:" | sed -e "s/^.*inet addr://" -e "s/ .*$//"`
printf "%s\005{+b }%s\005{-}" "$space" "$ipaddr"

View file

@ -1,6 +1,6 @@
#!/bin/sh -e
#
# mem_used: grab the current memory used
# mem_used: grab the current memory usage
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>

View file

@ -28,7 +28,7 @@ if [ "$1" = "--detail" ]; then
fi
for i in $MONITORED_TEMP `ls $DIR/*/temperature`; do
t=$(sed "s/^[^0-9]\+//" "$i" | sed "s/\s.*$//")
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
printf "\005{=b kY}%s\005{-}\005{= kY}\260C\005{-} " "$t"
break
done

View file

@ -23,8 +23,8 @@ if [ "$1" = "--detail" ]; then
exit 0
fi
for i in $MONITORED_TEMP `ls $DIR/*/temperature`; do
t=$(sed "s/^[^0-9]\+//" "$i" | sed "s/\s.*$//" | awk '{printf "%.0f", $1 *9/5 + 32}')
for i in `ls $DIR/*/temperature`; do
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i" | awk '{printf "%.0f", $1 *9/5 + 32}')
printf "\005{=b kY}%s\005{-}\005{= kY}\260F\005{-} " "$t"
break
done

View file

@ -23,7 +23,7 @@ if [ "$1" = "--detail" ]; then
fi
iwconfig=`/sbin/iwconfig 2>/dev/null`
bitrate=`echo "$iwconfig" | grep "Bit Rate." | sed "s/^.*Bit Rate.//" | sed "s/ .*$//g"`
bitrate=`echo "$iwconfig" | grep "Bit Rate." | sed -e "s/^.*Bit Rate.//" -e "s/ .*$//g"`
[ -z "$bitrate" ] && bitrate="0"
quality=`echo "$iwconfig" | grep "Link Quality=" | sed "s/^.*Link Quality=//" | sed "s/ .*$//g"`
quality=`echo "$iwconfig" | grep "Link Quality=" | sed -e "s/^.*Link Quality=//" -e "s/ .*$//g"`
echo | awk "{printf \"\005{=b Ck}%s\005{-}\005{= Ck}Mb/s,\005{-}\005{=b Ck}%d\005{-}\005{= Ck}%%\005{-} \", $bitrate, 100*$quality}"

6
debian/changelog vendored
View file

@ -10,8 +10,12 @@ byobu (2.26) unreleased; urgency=low
* bin/disk: fix up reading of MONITORED_DISK
* byobu.1: update documentation for new .byobu/statusrc file
* bin/ip_address: allow interface override
* bin/ip_address, bin/mem_used, bin/temp_c, bin/temp_f,
bin/wifi_quality: performance improvements, reduce the number of
forked shells by multiple sed-calls on one line by using a single
sed call with multiple -e arguments (thanks for the suggestion smoser)
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 17 Aug 2009 14:12:48 -0500
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 17 Aug 2009 14:23:19 -0500
byobu (2.25-0ubuntu1) karmic; urgency=low