From b98e05ba63f2e108df634b4d9f9e5530769c6b80 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 10 Jun 2021 18:58:52 +0200 Subject: Added scripts and readme --- battery-status | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 battery-status (limited to 'battery-status') diff --git a/battery-status b/battery-status new file mode 100755 index 0000000..c30b2c5 --- /dev/null +++ b/battery-status @@ -0,0 +1,17 @@ +#!/bin/sh + +# Send battery information to stdout + +# Get battery status +battery="/sys/class/power_supply/BAT0" +message="" + +if [ -d $battery ]; then + capacity=$(cat $battery/capacity) + status=$(cat $battery/status) + message="$capacity% $status" +else + message="No battery" +fi + +echo "$message" -- cgit v1.3