Last active
June 27, 2024 08:50
-
-
Save twocanoes/54641fd2e01ff571f81cf6a0d85705fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Thanks to Craig Hair for crafting this magic. | |
ARRAY=() | |
ARRAY=( "0:0" | |
"1:Grey" | |
"2:Space Grey" | |
"3:Yellow" | |
"4:Green" | |
"5:Blue" | |
"6:Red" | |
"7:Purple" | |
"8:Orange" | |
"9:9" | |
"unknown:unknown" | |
) | |
DeviceEnclosureColorNum=`/usr/libexec/remotectl dumpstate | grep "DeviceEnclosureColor" | cut -d' ' -f3` | |
printf "{"color" = "%s"}" "${ARRAY["${DeviceEnclosureColorNum}"]##*:}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment