diff options
| author | Daniel Friesel <derf@derf.homelinux.org> | 2009-05-24 19:54:28 +0200 |
|---|---|---|
| committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-05-24 19:54:28 +0200 |
| commit | 41be131dd0917bef70cd83b7db17c6a0cd9f9a4a (patch) | |
| tree | 02e977765815d54cf1a43c208fdbd30559b2d0ca | |
| parent | 6f1be59c0d74431f1899a30de7ce9968b9f39cb2 (diff) | |
fixed check_ac function
| -rw-r--r-- | etc/functions/check_ac | 7 |
1 files changed, 6 insertions, 1 deletions
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 |
