Example script: ex8.ksh


   1: #!/bin/ksh
   2: 
   3: trap huphandler  HUP
   4: trap ''          QUIT
   5: trap exithandler TERM INT
   6: 
   7: huphandler()
   8: {
   9:    print 'Received SIGHUP'
  10: }
  11: 
  12: exithandler()
  13: {
  14:    print 'Received SIGTERM or SIGINT'
  15:    exit 1
  16: }
  17: ## Execution starts here - infinite loop until interrupted
  18: while true; do
  19:    sleep 5
  20:    print -n "$SECONDS "
  21: done



  last modified 09/02/2006 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College