Differences
This shows you the differences between two versions of the page.
— |
arm:pengpod_batteriestand_im_terminal [2013/07/03 21:14] (current) boxtec created |
| + | ====== Batteriestand-Anzeige im Terminal (für PENGPOD ua.) ====== |
| + | Beitrag von T.D. gemäss: http://pengpod.com/pengwiki/index.php?title=Scripts |
| + | |
| + | ===== Installation ===== |
| + | Untenstehendes Skript mit chmod 755 lauffähig machen und im /home-Verzeichnis |
| + | zB. als Datei **akku** ablegen. |
| + | |
| + | Aufruf danach im Terminal |
| + | <code bash> |
| + | ./akku |
| + | </code> |
| + | |
| + | ===== Skript ===== |
| + | <code bash> |
| + | #!/bin/bash |
| + | # Script to show information about the battery |
| + | |
| + | # Collect the information from the system |
| + | INFO=$(grep -e "STATUS\|HEALTH\|CAPACITY" /sys/class/power_supply/battery/uevent | tr "=" " " | awk '{print $2}') |
| + | |
| + | # Split the information into different variables |
| + | STATUS=$(echo $INFO | awk '{print $1}') |
| + | HEALTH=$(echo $INFO | awk '{print $2}') |
| + | CAPACITY=$(echo $INFO | awk '{print $3}') |
| + | |
| + | # Show the information |
| + | echo "Status: $STATUS" |
| + | echo "Health: $HEALTH" |
| + | echo "Capacity: $CAPACITY" |
| + | </code> |
| + | |
| | | |