#!/bin/bash #echo "TERM: $TERM" if [ "${TERM}" == "" ] || [ "${TERM}" == "dumb" ]; then TERM="xterm-256color" fi function stars { width=$(tput cols) for ((counter = 1; counter < $width; counter++)); do # /usr/bin/printf "o" echo -e "*\c" done } function print_string { width=$(($(tput cols)/2-${#1}/2)) for ((counter = 1; counter < $width; counter++)); do printf " " done printf "%s\n" "$1" } HOSTNAME="$HOSTNAME" time=$(date +%H) if [ $time -le 12 ]; then welcomestr="Good Mornig" elif [ $time -gt 12 ] && [ $time -lt 19 ]; then welcomestr="Good Afternoon" elif [ $time -gt 19 ]; then welcomestr="Good Evening" fi stars printf "\n" print_string "Server: $HOSTNAME" stars printf "\n%s %s!\n\n" "$welcomestr" "$(whoami)" printf "%s\n" "$(date +"%A, %d %B %Y, %T")" printf "Uptime: %s\n" "$(uptime)" cat /home/lucas/.bash_motd