Use OSTYPE instead of uname whenever possible for better speed.

This commit is contained in:
Hong Xu 2016-10-05 01:06:59 -07:00
commit 630211852b
6 changed files with 9 additions and 9 deletions

View file

@ -64,7 +64,7 @@ if [[ "$OSTYPE" = darwin* ]] ; then
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
}
elif [[ $(uname) == "Linux" ]] ; then
elif [[ "$OSTYPE" = linux* ]] ; then
function battery_is_charging() {
! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]