polybar / polybar/polybar-scripts
battery-combined-udev 34: arithmetic expression: expecting primary: ""31800000 + 0""
Open
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 2.6k
- Forks
- 331
- PR merge metrics
- No merged PRs in 30d
Description
When I try to use battery-combined-udev it gives me this error: 34: arithmetic expression: expecting primary: ""31800000 + 0""
A similar error happens the following lines:
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
After changing it to the following, the problem was fixed
battery_level=$(($battery_level_0 + $battery_level_1))
battery_max=$(($battery_max_0 + $battery_max_1))
battery_percent=$(($battery_level * 100))
battery_percent=$(($battery_percent / $battery_max))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the battery-combined-udev script and reproduce the arithmetic error with the battery setup described in the issue. Inspect the four arithmetic expressions shown in the report, then verify that the script calculates the combined level, maximum and percentage without the reported shell error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100