#!/bin/bash # example07 # silly 20080415rm # Playing around to illustrate a few techniques clear echo -e "\n\t\t\tWhat does `whoami` want to do?\n" echo -e "\t\t\tMake a selection from the following by" echo -e "\t\t\ttyping in the corresponding number then" echo -e "\t\t\thitting enter. \c" sleep 1 echo -e "\n\n\t\t\t1 Do nothing" echo -e "\t\t\t2 Get the time and date" echo -e "\t\t\t3 Do something silly" echo -e "\t\t\t\t\c" read response case $response in 1) echo -e "\n\n\t\t\tLooks like we're feeling lazy today :^)\n\n\n" sleep 5 ;; 2) echo -e "\n\n\t\t\t`date`" sleep 4 clear ;; 3) clear silly=0 while [ $silly -lt 10 ]; do echo -e "\n\n\n\t\t\c" sleep 1 echo -e "`whoami` is a darn nice person, I \c" echo -e "don't care what anybody says! \c" sleep 1 clear let silly=$silly+1 done sleep 2 ;; *) clear echo -e "\n\n\t\t\tYou did not respond correctly!!" sleep 2 echo -e "\n\t\tYou are lucky I didn't put you in an infinit loop!" sleep 2 echo -e "\n\t\tYou will now have to wait 1 minute before you get" echo -e "\t\tyour command prompt back \c" sleep 10 echo -e "\n\n\n\n" ;; esac #end of script