mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 06:23:19 -07:00
* usr/lib/byobu/battery:
- protect against division by zero
This commit is contained in:
parent
b0f059c996
commit
6e94f12096
2 changed files with 23 additions and 19 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,8 @@
|
||||||
byobu (4.44) unreleased; urgency=low
|
byobu (4.44) unreleased; urgency=low
|
||||||
|
|
||||||
* UNRELEASED
|
[ Dustin Kirkland ]
|
||||||
|
* usr/lib/byobu/battery:
|
||||||
|
- protect against division by zero
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 22 Oct 2011 03:21:46 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 22 Oct 2011 03:21:46 -0500
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ __battery() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
if [ $rem -ge 0 ] && [ $full -gt 0 ]; then
|
||||||
percent=$(((100*$rem)/$full))
|
percent=$(((100*$rem)/$full))
|
||||||
if [ "$percent" -lt 33 ]; then
|
if [ "$percent" -lt 33 ]; then
|
||||||
color="R k"
|
color="R k"
|
||||||
|
@ -86,6 +87,7 @@ __battery() {
|
||||||
*) sign="$state" ;;
|
*) sign="$state" ;;
|
||||||
esac
|
esac
|
||||||
color $bcolor; printf "%s" "$percent"; color -; color $color; printf "%s" "$sign"; color --
|
color $bcolor; printf "%s" "$percent"; color -; color $color; printf "%s" "$sign"; color --
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue