From 41be131dd0917bef70cd83b7db17c6a0cd9f9a4a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 24 May 2009 19:54:28 +0200 Subject: fixed check_ac function --- etc/functions/check_ac | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'etc/functions') diff --git a/etc/functions/check_ac b/etc/functions/check_ac index 6ea4bb1..429ed3f 100644 --- a/etc/functions/check_ac +++ b/etc/functions/check_ac @@ -1,3 +1,8 @@ ## vim:ft=zsh ## check_ac - returns true if machine is running on AC -[[ $(cat /sys/class/power_supply/AC/online) == 1 ]] +typeset file=/sys/class/power_supply/AC/online +if [[ -f $file ]] { + [[ $(cat /sys/class/power_supply/AC/online) == 1 ]] + return $? +} +return 0 -- cgit v1.2.3