Last active
February 6, 2020 14:24
-
-
Save tjumyk/d246c2b5b6d7e83aea3ae631372cbd9d to your computer and use it in GitHub Desktop.
Fancy motd script for my Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cpu_model='Unknown CPU' | |
cpu_cores='?' | |
if [ -r "/proc/cpuinfo" ]; then | |
cpu_model=$(cat /proc/cpuinfo | grep 'model name' | head -n 1 | sed 's/^.*:\s*//') | |
cpu_cores=$(cat /proc/cpuinfo | grep 'processor' | wc -l) | |
fi | |
mem_total='?G' | |
if [ -x "/usr/bin/free" ]; then | |
mem_total=$(free -h --si | sed -n '2{p;q}' | awk '{print $2}') | |
fi | |
disks='' | |
if [ -x "/bin/lsblk" ]; then | |
i=0 | |
d='' | |
for row in $(/bin/lsblk -d -n -o "type,size,rota" | grep disk | sed 's/^disk\s*//'); do | |
if [ $i -eq 0 ]; then | |
d="$row" | |
fi | |
if [ $i -eq 1 ]; then | |
if [ "$row" -eq 0 ]; then | |
d="$d SSD" | |
else | |
d="$d HDD" | |
fi | |
if [ -z "$disks" ]; then | |
disks="$d" | |
else | |
disks="$disks + $d" | |
fi | |
fi | |
i=$(($i+1)) | |
if [ $i -eq 2 ]; then i=0; fi | |
done | |
fi | |
gpu="Unknown GPU" | |
if [ -x "/usr/bin/lspci" ]; then | |
gpu=$(lspci | grep -P '(VGA|3D).*NVIDIA' | sed 's/^.*:\s*//;s/\s*(rev ..)$//') | |
fi | |
host=$(hostname) | |
padding1=$(( 80-${#host} )) | |
padding2=80 | |
line1="${cpu_model} (${cpu_cores} cores) | ${mem_total} Memory" | |
line2="$gpu | $disks" | |
printf " | |
Welcome to visit | |
██╗ ██╗███████╗██╗ ██╗ ██╗██╗███╗ ██╗ ███╗ ███╗██╗ █████╗ ██████'s | |
██║ ██╔╝██╔════╝██║ ██║ ██║██║████╗ ██║ ████╗ ████║██║██╔══██╗██╔═══██╗ | |
█████╔╝ █████╗ ██║ ██║ ██║██║██╔██╗ ██║ ██╔████╔██║██║███████║██║ ██║ | |
██╔═██╗ ██╔══╝ ██║ ╚██╗ ██╔╝██║██║╚██╗██║ ██║╚██╔╝██║██║██╔══██║██║ ██║ | |
██║ ██╗███████╗███████╗╚████╔╝ ██║██║ ╚████║ ██║ ╚═╝ ██║██║██║ ██║╚██████╔╝ | |
╚═╝ ╚═╝╚══════╝╚══════╝ ╚═══╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═════╝ | |
$(hostname)%${padding1}s | |
%${padding2}s | |
" "$line1" "$line2" | |
Hi, i would like to know how to convert text into that format ('cause i'm not doing it by hand).
Nevermind, i used this converter with 'ANSI Shadow' font
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i would like to know how to convert text into that format ('cause i'm not doing it by hand).