Skip to content

Instantly share code, notes, and snippets.

@twocanoes
Last active December 29, 2023 06:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twocanoes/54641fd2e01ff571f81cf6a0d85705fd to your computer and use it in GitHub Desktop.
Save twocanoes/54641fd2e01ff571f81cf6a0d85705fd to your computer and use it in GitHub Desktop.
#!/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