Files
Server-scripts/profile_motd1.sh
T

37 lines
895 B
Bash
Raw Normal View History

2026-04-14 23:55:08 +02:00
#!/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