mirror of
https://gitee.com/mirrors/ohmyzsh.git
synced 2026-10-13 00:14:22 +08:00
Use OSTYPE instead of uname whenever possible for better speed. (#5496)
This commit is contained in:
1 parent
98cd3973d2
commit
a56eac7a71
6 files changed
+9
-9
No files matched your search
@@ -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 ]]
|
||||
|
||||
Reference in new issue
Block a user