| 
     
       |  |  |  | 
            
              | 
             
               | 
               
                 |  | UGU: Unix Guru Universe - Unix Tip #4186- July 28, 2012
 -  Home : Help
 : Today's Tip Unix Tip #4186- July 28, 2012
 
 
BE ALARMED 
Name the following script
 alarm. Make it executable
 and them invoke it as:
 
 % alarm 10 "Time for tea"
 
 After 10 seconds machine will
 echo Time for Tea
 and beep five times.....
 
 ---------------
 
 #! /usr/bin/ksh
 # alarm program
 # displays a message at
 if [ $# -ne 2 ]
 then
 echo "USAGE : $0 seconds message"
 exit 1
 fi
 
 time=$1
 mesg=$2
 signal_alarm()
 {
 sleep $time
 banner $mesg
 for i in 1 2 3 4 5 6 7 8 9
 do
 if [ $i -eq 2 -o $i -eq 4 -o $i -eq 6 -o $i -eq 8 ]
 then
 sleep 1
 else
 tput bel
 fi
 done
 }
 
 case $1 in
 
 [0-9][0-9][0-9] | [0-9] | [0-9][0-9] )signal_alarm &;;
 *)echo Seconds range is from 0 to 199;;
 
 esac
 
 
 
 NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.
 
 LAST 5 TIPS
 4185
 - NUMBERING A FILE
 4184
 - BACKING UP FILES 
 4183
 - SNEAK THE EDUCATION IN
 4182
 - MANIPULATE MULTIPLE FILES
 4181
 - UNDO HP SECURE PASSWORD FACILITY
 I want to 
 SUBSCRIBE
 and get a UGU Tip everyday.
 I want to 
 UNSUBSCRIBE
 and NOT get a UGU Tip everyday.
 If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
 |  |  
                 |  |  
                 |   Copyright 1994-2024 Unix Guru Universe 
 |  |  |  |  |