Re: [wmii] Status script

From: Jani H. Lahtinen <>
Date: Mon, 31 Oct 2005 14:08:20 +0200

The difference between plan 9 sed and linux sed seems to have caused
some problems with my status script. None the less the following
replacement to Garbeam's script now prints the WLAN quality and the
battery status:

while(wmir write /bar/items/60status/label/text $text >[2]/dev/null) {
    date=`{date '+%H:%M'}
    signal=`{cat /proc/net/wireless | awk '{print $3}' | sed -n
    cap=`{cat /proc/acpi/battery/BAT0/info | sed -n 's/last full
capacity://p' | sed 's/ mWh//'}
    rem=`{cat /proc/acpi/battery/BAT0/state | sed -n 's/remaining
capacity://p' | sed 's/ mWh//'}
    battery=`{dc -e $"rem^' 100 * '$"cap^' / p'}
    text=$"date^' '^$"signal^' '^$"battery
    sleep $DELAY

The use of dc is funny, but I did not find arithmetic expressions in rc
like in zsh for example. If I could next find a good way to notify of
new emails...


ext Georg Neis wrote:

>The status script, like all actions, is executed under an environment
>where PATH contains 9PREFIX/bin before all the usual bin directories.
>This means that sed is the Plan 9 sed, which uses the same regular
>expression notation as all the other Plan 9 tools:
>If I remember correctly, this is what on Unix is known as extended REs,
>in contrast to the basic REs that the Unix sed uses.
Received on Mon Oct 31 2005 - 13:09:38 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:24 UTC