diff options
Diffstat (limited to 'etc/functions')
-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 |