home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: notify Chapter 5
The C Shell
Next: Reference: popd





onintr -


"On interrupt." Used in shell scripts to handle interrupt signals (similar to the Bourne shell's trap 2 and trap "" 2 commands). The first form is like a goto label . The script will branch to label : if it catches an interrupt signal (e.g., CTRL-C). The second form lets the script ignore interrupts. This is useful at the beginning of a script or before any code segment that needs to run unhindered (e.g., when moving files). The third form restores interrupt handling that was previously disabled with onintr - .


onintr cleanup     # go to "cleanup" on interrupt
 .                 # shell script commands
cleanup:           # label for interrupts
  onintr -         # ignore additional interrupts
  rm -f $tmpfiles  # remove any files created
  exit 2           # exit with an error status

Previous: Reference: notify UNIX in a Nutshell: System V Edition Next: Reference: popd
Reference: notify Book Index Reference: popd

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System