dotfiles/.bin/motd.sh
2023-02-22 08:31:38 +01:00

34 lines
875 B
Bash

#!/bin/sh
OS=$(uname -s)
OSVER=$(uname -r)
OSARCH=$(uname -m)
CPUS=$(sysctl -n hw.ncpufound)
CPUMODEL=$(sysctl -n hw.model)
CPUSPEED=$(sysctl -n hw.cpuspeed)
MEM=$(printf "$(sysctl -n hw.physmem)/1024/1024\n" | bc)
INET=$(ifconfig vio0 | grep "inet")
[ -z "$INET" ] && INET=$(ifconfig em0 | grep "inet")
[ -z "$INET" ] && INET=$(ifconfig bge0 | grep "inet")
printf '%s\n' ' ___ _____ ____ ____ _ _ _____ ____ ____
/ __)( _ )( _ \( ___)( \/ )( _ )(_ _)( _ \
( (__ )(_)( )(_) ))__) \ / )(_)( _)(_ )(_) )
\___)(_____)(____/(____) \/ (_____)(____)(____/
'
printf " OS: %s" "$OS"
printf " Version: %s" "$OSVER"
printf " Architecture: %s\n" "$OSARCH"
printf " CPU: %s\n" "${CPUS}x $CPUMODEL"
printf " SPEED: %s" "${CPUSPEED}Mhz"
printf " Memory: %s\n\n" "${MEM}MB"
printf " Interfaces:\n %s\n\n" "$INET"
printf " Welcome to $(hostname)\n\n"