Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Script para mostrar la temperatura de la Raspberry Pi en terminal
- # Se pueden ajustar los valores para mostrar colores a diferentes
- # temperaturas.
- # Por defecto:
- # 40 grados o menos -> verde (32)
- # Entre 41 y 54 -> amarillo (33)
- # Superior o igual a 55 -> rojo (31)
- # http://belinuxmyfriend.blogspot.com
- # Version: 1.0b con decimales
- # Autor: Manel Alonso (@drkbcn)
- mgrados=`cat /sys/class/thermal/thermal_zone0/temp`
- engrados=`expr $mgrados / 1000`
- decimales=`awk 'BEGIN{printf("%0.2f", '$mgrados' / 1000)}'`
- if [ $engrados -le 40 ]; then
- echo -e "Temperatura CPU:\033[32m $decimales"
- elif [ $engrados -gt 40 ] && [ $engrados -lt 55 ]; then
- echo -e "Temperatura CPU:\033[33m $decimales"
- else
- echo -e "Temperatura CPU:\033[31m $decimales"
- fi
Advertisement
Add Comment
Please, Sign In to add comment