[Grml] Bugreport zshrc+acpi
Kai Wilke
kiste at netzworkk.de
Thu Sep 18 22:25:28 CEST 2008
High, high ...
* Frank Terbeck <ft at grml.org> schrieb am [18.09.08 19:01]:
> Kai Wilke <kiste at netzworkk.de>:
> > to works (my configuration /etc/zsh/zshrc):
> >
> > battery()
> > {
>
> I minor nitpick: the rest of the functions in that files uses
> 'functname() {' and I think we should stay consistent.
Another way (consistent?):
# {{{ display battery status on right side of prompt via running 'BATTERY=1 zsh'
if [[ $BATTERY == 1 ]] ; then
if ! check_com -c acpi ; then
BATTERY=0
fi
fi
# Benoetigt das paket acpi.
battery()
{
if [[ $BATTERY == 1 ]] ; then
PERCENT=${${"$(acpi 2>/dev/null)"}/(#b)[[:space:]]##Battery <->: [^0-9]##, (<->)%*/${match[1]}}
if [[ -z "$PERCENT" ]] ; then
PERCENT='acpi not present'
else
if [[ "$PERCENT" -lt 20 ]] ; then
PERCENT="warning: ${PERCENT}%%"
else
PERCENT="${PERCENT}%%"
fi
fi
fi
}
# }}}
PERCENT is not ever integer. See Code:
,----[ Line 946 ]
| [[ -z "$PERCENT" ]] && PERCENT='acpi not present'
|
| if [[ "${PERCENT%%%}" -lt 20 ]] ; then
| PERCENT="warning: ${PERCENT}%"
| fi
`----
>
> [...]
mfg Kiste
--
#######################################################################
Netzworkk grml - Linux Live CD fuer Sysadmins
Kai Wilke http://grml.org
kiste at netzworkk.de
http://www.netzworkk.de
http://netzworkk.berlios.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://ml.grml.org/pipermail/grml/attachments/20080918/1757d075/attachment-0003.pgp>
More information about the Grml
mailing list