From b6a26d4df10c93eace827abc109a68cc6fa613e7 Mon Sep 17 00:00:00 2001 From: Yann 'Ze' Richard Date: Mon, 9 Jul 2012 11:32:02 +0200 Subject: [PATCH 1/2] Prompt.bash : Verify if acpi command exists to avoid error message. --- prompt.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/prompt.bash b/prompt.bash index 5b5eb4e..edfb833 100644 --- a/prompt.bash +++ b/prompt.bash @@ -159,6 +159,7 @@ git_branch_color() # Get the battery status in percent battery() { + command -v acpi >/dev/null 2>&1 || { echo -n ""; return; } bat=`acpi --battery | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"` if [ ${bat} -lt 90 ] ; then echo -n " ${bat}%" From 0aa9f952dae19972842c672d2f62354e96d67fd3 Mon Sep 17 00:00:00 2001 From: Yann 'Ze' Richard Date: Mon, 9 Jul 2012 13:28:29 +0200 Subject: [PATCH 2/2] Fix : no power_supply support message Close #1 --- prompt.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prompt.bash b/prompt.bash index edfb833..b8d9751 100644 --- a/prompt.bash +++ b/prompt.bash @@ -160,7 +160,11 @@ git_branch_color() battery() { command -v acpi >/dev/null 2>&1 || { echo -n ""; return; } - bat=`acpi --battery | sed "s/^Battery .*, \([0-9]*\)%.*$/\1/"` + 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 echo -n " ${bat}%" else