[BACK]Return to termbar CVS log [TXT][DIR] Up to [x61] / dotfiles / termbar

File: [x61] / dotfiles / termbar / termbar (download)

Revision 1.2, Mon Jun 1 16:24:12 2020 UTC (19 months, 3 weeks ago) by gonzalo
Branch: MAIN
Changes since 1.1: +11 -13 lines

Add some nice colours and fix the SSID maybe for now

#!/bin/sh

yel='\033[33m'
pur='\033[35m'
gre='\033[32m'
rst='\033[0m'

pipe="${pur}|${rst}"

while true; do
	CPU_SPEED=$(sysctl hw.cpuspeed | cut -d "=" -f 2 | cut -d "." -f 1)
	CPU_TEMP=$(sysctl hw.sensors.cpu0.temp0 | cut -d "=" -f 2 | cut -d "." -f 1)
	RAM=$(top | grep Memory | awk {'print $6'})
	BAT_STATUS=$(sysctl hw.sensors.acpiac0.indicator0 | cut -d "=" -f 2 | cut -d "." -f 1)
	BAT=$(apm -l)
	DATE=$(date +"%B %d - %H:%M")
	SSID=$(ifconfig | grep ieee | awk -F'"' '$0=$2')
#	SSID=$(ifconfig | grep ieee | awk '/join/ {print $3}')
	INTIP=$(ifconfig trunk0 | grep inet | awk '{print $2}')
	IP=$(dig +short myip.opendns.com @resolver1.opendns.com | awk {'printf $1'})
	printf "  $DATE ${pipe} ${gre}CPU:${rst} $CPU_SPEED ($CPU_TEMPĀ°) ${pipe} ${gre}Free Ram:${rst} $RAM "
	printf "${pipe} ${gre}Bat:${rst} $BAT - $BAT_STATUS ${pipe} ${gre}SSID:${rst} $SSID ${pipe}"
	printf " ${gre}Pub. IP:${rst} $IP - ${gre}Int. IP:${rst} $INTIP \r"
	sleep 15
done