Merge pull request #2 from Zeuh/master
Fix: test if acpi exists to avoid error message
This commit is contained in:
commit
e653135dd3
1 changed files with 6 additions and 1 deletions
|
|
@ -159,7 +159,12 @@ git_branch_color()
|
||||||
# Get the battery status in percent
|
# Get the battery status in percent
|
||||||
battery()
|
battery()
|
||||||
{
|
{
|
||||||
bat=`acpi --battery | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"`
|
command -v acpi >/dev/null 2>&1 || { echo -n ""; return; }
|
||||||
|
bat=`acpi --battery 2>/dev/null | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"`
|
||||||
|
if [ "${bat}x" == "x" ] ; then
|
||||||
|
echo -n ""
|
||||||
|
return
|
||||||
|
fi
|
||||||
if [ ${bat} -lt 90 ] ; then
|
if [ ${bat} -lt 90 ] ; then
|
||||||
echo -n " ${bat}%"
|
echo -n " ${bat}%"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue