Skip to content

Instantly share code, notes, and snippets.

@megrxu
Last active April 29, 2022 08:14
Show Gist options
  • Save megrxu/b9a29908ec56af4a4a6fcf70ef7a296f to your computer and use it in GitHub Desktop.
Save megrxu/b9a29908ec56af4a4a6fcf70ef7a296f to your computer and use it in GitHub Desktop.
Message of one day.
#!/bin/bash
#define the filename to use as output
motd="/tmp/motd"
# Collect useful information about your system
# $USER is automatically defined
HOSTNAME=`uname -n`
KERNEL=`uname -r`
CPU=`cat /proc/cpuinfo | grep 'model name' | uniq | cut -f2 -d":"`
ARCH=`uname -m`
# The different colours as variables
W="\033[01;37m"
B="\033[01;36m"
R="\033[01;31m"
X="\033[00;37m"
clear > $motd # to clear the screen when showing up
echo -e "$R#=============================================================================#" >> $motd
echo -e " $W Welcome $B $USER $W to $B $HOSTNAME " >> $motd
echo -e " $R ARCH $W= $ARCH " >> $motd
echo -e " $R KERNEL $W= $KERNEL " >> $motd
echo -e " $R CPU $W=$CPU " >> $motd
echo -e " $R Uptime $W= $(uptime -p) " >> $motd
echo -e "$R#=============================================================================#" >> $motd
echo -e "$X" >> $motd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment