[Grml] Bugreport zshrc+acpi

Frank Terbeck ft at grml.org
Wed Sep 17 17:24:27 CEST 2008


Michael Prokop <mika at grml.org>:
> * Kai Wilke <kiste at netzworkk.de> [20080914 11:27]:
> > found error in /etc/zsh/zshrc of grml-etc-core-0.3.49.
> > line 948:
> > --- if [ "${PERCENT%%%}" -lt 20 ]] ; then
> > +++ if [ "${PERCENT%%%,}" -lt 20 ]] ; then

Just stripping off the comma there is not acceptable, IMO.

> > acpi output:
> > Battery 0: Full, 100%, design capacity 65120 mAh
[...]
> # acpi
>      Battery 0: Full, 100%
> # acpi
>      Battery 0: Discharging, 100%, discharging [...]
[...]
> @Frank: what do you suggest? AFAICS we should improve the way

Okay, well for me acpi just says 'No support for device type:
power_supply'. 

Does 'acpi' only output *one* line at all times?

If I take your output above, we could do this:

[snip]
PERCENT=${${"$(acpi 2>/dev/null)"}/(#b)[[:space:]]##Battery <->: [^0-9]##, (<->)%*/${match[1]}}
[snap]

Needs extended_glob set, but that's the case in that position already.
Could you two test the expression above. If it works, I'll commit it
later this evening.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



More information about the Grml mailing list