Prompt.bash : Verify if acpi command exists to avoid error message.

This commit is contained in:
Yann 'Ze' Richard 2012-07-09 11:32:02 +02:00
parent 96d0b6d195
commit 7c096e567f

View File

@ -159,6 +159,7 @@ git_branch_color()
# Get the battery status in percent # Get the battery status in percent
battery() battery()
{ {
command -v acpi >/dev/null 2>&1 || { echo -n ""; return; }
bat=`acpi --battery | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"` bat=`acpi --battery | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"`
if [ ${bat} -lt 90 ] ; then if [ ${bat} -lt 90 ] ; then
echo -n " ${bat}%" echo -n " ${bat}%"