#!/bin/bash clear tput setab 4 # Window too small ################## if [ "$(tput cols)" -lt "46" ];then # space="$(tput cols)" # until [ "$space" = "0" ];do # echo -n " " # let space-=1 # done # echo;echo # tput sgr0 # exit 0 # fi # ##################################### # Change to anything other than 1 to disable Fortune (or its' missing message). fortune=1 date="$(date '+%A %d %B %Y, %H:%M')" # Version ######################################### function ver { # dis="$(lsb_release -i|grep -o .)" # rel="$(lsb_release -r|grep -o .)" # cnm="$(lsb_release -c|grep -o .)" # # x=0 # for a in $dis;do # if [ "$x" -lt "14" ];then # let x+=1 # else # echo -n "$a" # fi # done # # echo -n " " # x=0 # for a in $rel;do # if [ "$x" -lt "8" ];then # let x+=1 # else # echo -n "$a" # fi # done # # echo -n ", '" # x=0 # for a in $cnm;do # if [ "$x" -lt "9" ];then # let x+=1 # else # echo -n "$a" # fi # done # echo -n "'" # } # ################################################### # Date, right. space="$(expr $(expr $(tput cols) - $(echo $date|wc -c)) - 1)" until [ "$space" = "0" ];do echo -n " " let space-=1 done echo -ne "$date \\r" # Username@Hostname, center. space="$(expr $(tput cols) / 2) - $(expr $(expr $(echo $USER@$HOSTNAME|wc -c) - 1) / 2)" until [ "$space" = "0" ];do echo -n " " let space-=1 done echo -ne "$USER@$HOSTNAME\\r" # OS version, left. echo -n " ";ver tput sgr0 echo if [ "$fortune" = "1" ];then if [ -f /usr/games/fortune ];then quote="$(fortune -s -n $(expr $(tput cols) / 3))" else quote="Install 'fortune' to see a random message here." fi space="$(expr $(expr $(tput cols) / 2) - $(expr $(expr $(echo $quote|wc -c) - 1) / 2) - 2)" echo until [ "$space" = "0" ];do echo -n " " let space-=1 done echo "$quote" fi echo exit 0