< Day Day Up > |
If a script is interrupted with the Interrupt key, it terminates and control is returned to the C shell; that is, you get your prompt back. The onintr command is used to process interrupts within a script. It allows you to either ignore the interrupt (^C) or transfer control to another part of the program before exiting. Normally, the interrupt command is used with a label to "clean up" before exiting. The onintr command without arguments restores the default action. Example 10.49.(The Script) 1 onintr finish 2 < Script continues here > 3 finish: 4 onintr # Disable further interrupts 5 echo Cleaning temp files 6 rm $$tmp* ; exit 1 EXPLANATION
|
< Day Day Up > |