When run without options it spits out:
cat: can't open '/sys/class/power_supply/BAT0/status': No such file or directory
battery: line 90: [: ==: unary operator expected
cat: can't open '/sys/class/power_supply/BAT0/charge_now': No such file or directory
cat: can't open '/sys/class/power_supply/BAT0/charge_full': No such file or directory
battery: line 97: 100 * / : syntax error: operand expected (error token is "/ ")
Instead check the BAT0 exists, if it idoesn't, check the /sys/class/power_supply/ folder for other possible names and ask the user if they want to try that. You could go even further and check each directory in the power_supply directory and if it has a capacity file then it's likely a battery and only list those.
When run without options it spits out:
Instead check the BAT0 exists, if it idoesn't, check the /sys/class/power_supply/ folder for other possible names and ask the user if they want to try that. You could go even further and check each directory in the power_supply directory and if it has a
capacityfile then it's likely a battery and only list those.