I want to know which command should I use in my script to check the Battery if it's present or absent. like an if condition
. thanks
When I try with following command I get error.
test@test-pc:~$ cat /proc/acpi/battery/BAT0/*
cat: /proc/acpi/battery/BAT0/*: No such file or directory
test@test-pc:~$ cat /sys/class/power_supply/BAT0/status
cat: /sys/class/power_supply/BAT0/status: No such file or directory
Also acpi
is already installed.
I used dmesg | grep battery
to check the battery and the result was this:
[ 1.309638] ACPI: Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared
[ 1.309643] ACPI: Battery Slot [BAT1] (battery present)
The result of acpi -i
is as following too:
Battery 0: Unknown, 79%
Battery 0: design capacity 8244 mAh, last full capacity 6591 mAh = 79%
And now how can I use this result in my script?