由专门函数处理相应的信号

Bourne、bash和Korn Shell允许你按照以下方式处理进入程序的信号、忽略信号或者为特定的信号指定特定的行为,以及重置信号的默认行为,C和TC Shell被限制只能处理中断字符^C(Control-C).

   表1.2显示的是进程可以使用的标准信号。

                       表1.2 标准信号

 

Number Name 描述 对进程的作用
0 EXIT shell exits termination
1 SIGHUP terminal has disconnected termination
2 SIGINT user pressess Controc-C termination
3 SIGQUIT user presses Control-\ termination
4 SIGILL illegal hardware instruction program error
5 SIGTRAP produced by debugger program error
8 SIGFPE arithmetic error;e.g.,division by zero program error
9 SIGKILL cannot be caught or ignored termination
10 SIGUSR1 application-defined signal for user  
11 SIGSEGV invalid memory references program error
12 SIGUSR2 application-defined signal for user  
13 SIGPIPE broken pipe conncetion operator error
14 SIGALRM time-out alarm sent
15 SIGTERM termunation of a program termination
17 SIGCHLD child process has stopped or died ignored
18 SIGCONT starts a stopped job;can't be handled or ignored continue if stopped
19 SIGSTOP stops a job;can't be handled or ignored stops the process
20 SIGSTP interactive stop;user presses Control-z stops the process
21 SIGTTIN a background job is trying to read from the controlling terminal stops the process
22 SIGTTOU a background job is trying to write to the controlling terminal stops the process