I'm trying to make script that monitor laptops (T480) batteries. There are 2 batteries, internal and external. Externals information seems to disappear capacity while it's charging.
/sys/class/power_supply/BAT0/capacity
Problem
I made check for the charging, if the file exists, problem is that it pass the -f on missing capacity, it's ASCII text so it shouldn't be a problem.
Script
I've tried -e -d -c too, but no success.
#!/bin/bash
...
[[ -f /sys/class/power_supply/BAT0/capacity ]] && {
    EXTERNAL="$(cat /sys/class/power_supply/BAT0/capacity)" 
   ...some logic
}
..
 
    