clean up battery code

This commit is contained in:
2023-11-19 20:49:46 -07:00
parent 407ea45346
commit 5b0230806b
3 changed files with 26 additions and 25 deletions
+7 -4
View File
@@ -1,7 +1,10 @@
#!/bin/sh
envstat -s acpibat0:charge \
| sed 1,2d \
| cut -d ':' -f 2 \
| awk '{print $1}' \
| cut -d '.' -f 1
| awk '
NR == 3 {
sub("^[^:]*:", "", $1);
sub(":.*", "", $1);
sub("\\..*", "", $1);
print $1;
}'