I am writing my .zshrc. I want my prompt to show my battery level which is stored in
/sys/class/power_supply/BAT0/capacity
I wrote a function that will take the value from the file and change the color of the digits (green if it is greater than 50, orange if greater than 20, and red otherwise.
The problem is I get this:
/home/user/.zshrc:5: parse error: condition expected: $getPower
My zshrc shows this for the $getPower function
3 function getPower ()
4 {
5 cat /sys/class/power_supply/BAT0/capacity
6 }
7 function batteryLeft ()
8 {
9 if [[ getPower > 50 ]]; then
10 echo "Phrase"
11 fi
12}
On ZSH Documentation the first 2 code samples have 2 different ways to declare a function, with a function
keyword and one without. Not sure what the problem is.