Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2014 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/938b3dd73a611d462baa to your computer and use it in GitHub Desktop.
Save anonymous/938b3dd73a611d462baa to your computer and use it in GitHub Desktop.
/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -a -l -f | while read reading; do
set -- $reading;
temperature="${@:$[$#-1]:1}";
sensor="${@:2:$[$#-3]}";
sensor="${sensor:0:$[${#sensor}-1]}";
sensor="${sensor//(}";
sensor="${sensor//)}";
sensor="$(echo "${sensor:0:32}" | tr '[:lower:]' '[:upper:]')";
short=$[32-${#sensor}];
i=0;
while ((i++ < short)); do sensor="$sensor "; done;
echo "$sensor"$' \e[35m'"${temperature}°F"$'\e[0m';
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment