Goles/Battery

[Error] Not working..

abspython opened this issue · 2 comments

I installed as per instruction and when I run battery in my terminal ("Hyper"), this error is produced..

cat: /sys/class/power_supply/BAT0/status: No such file or directory
/usr/local/bin/battery: line 90: [: ==: unary operator expected
cat: /sys/class/power_supply/BAT0/charge_now: No such file or directory
cat: /sys/class/power_supply/BAT0/charge_full: No such file or directory
/usr/local/bin/battery: line 97: 100 *  / : syntax error: operand expected (error token is "/ ")
[%] ⚡ 

(Checked on Pop!_OS, Dec 8 2020 00:06 UTC)

Maybe too late to the party, but the error is around the line 38 of the script:
battery_path=/sys/class/power_supply/BAT0

You simply have to replace BAT0 for BAT1, so it looks like this:
battery_path=/sys/class/power_supply/BAT1

Doing that I got the script to work flawlessly.

Happy coding.

Here's the link to the commit in case the master branch changes after this comment: the line to be changed should be line 38.

b57436b#diff-f3d1701e1d575e1294786989517866986bc97343e07af63e201f46ba0be5806aL38

Yeah, thanks. I had just started using Linux at that time. Now, I know how it commands works. Thanks btw for the solution. Closing the issue.