View Single Post
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#643
Originally Posted by slarti View Post
Exactly. That was off the top of my head. How do you test for -1 in sh? Because that's what the percentage is when in flight mode.
I edited the sript to
Code:
#!/bin/sh

percent=$(qdbus --system com.nokia.csd /com/nokia/csd/csnet com.nokia.csd.CSNet.SignalStrength.SignalPercent)
if [[ $percent -ge 25 ]]
then printf "{{yellow}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}}"
else if [[ $percent -le 24 ]]
then printf "{{red}}{{=$(($percent/100)).$((($percent%100)/10))$(($percent%10))}}"
else if [[$percent -eq -1]]
then echo -n "{{red}}flightmode on"
fi
fi
fi
E: But it's not working...
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member

Last edited by Win7Mac; 2013-02-18 at 18:50.