trap command

[træp kəˈmænd][træp kəˈmɑ:nd]

[计] 陷阱命令

  • When a signal is caught the current command being executed attempts to complete before the trap command takes over .

    在捕捉到信号后,正在执行的当前 命令会尝试在 trap接管之前结束执行。

  • The trap command is a more generalized solution for trapping more serious errors based on the signals raised when a command fails such as core dump memory error or when a command has been forcibly terminated by a kill command .

    trap 命令是用于跟踪更为严重的错误的通用型解决方案,基于命令失败时发出的信号,如内核转储、内存错误或kill命令强行终止了命令。

  • The first trap command causes the stopsleep function to be run whenever a SIGCHLD SIGINT or SIGTERM signal is received .

    第一个 trap 命令将使stopsleep函数在接受到SIGCHLD、SIGINT或SIGTERM信号时运行。

  • This is accomplished using the trap command as demonstrated in Listing 8 below .

    可以通过下面清单8所示的 trap 命令完成此操作。

  • To catch a signal that is sent to your process use the built-in trap command .

    要捕捉发送到您的进程的信号,请使用内置的 trap 命令

  • The trap command prevents the script from being interrupted by the user ( by pressing control-C during boot for example ) while the script executes .

    trap 命令防止用户在脚本执行时中断(例如,在引导时键入control-C)脚本。

  • There are two variables that come in handy when dealing with traps to give you more information on the script termination LINENO and BASH_COMMAND .

    在处理 trap以获得更多有关脚本终止的信息时,有两个变量 方便 使用,它们分别为 LINENO和BASH COMMAND

  • It is considered good form that you use the signal names and not the signal numbers within the trap command .

    trap 命令中使用信号名而不是信号号码被认为是一种好方法。

  • The first is the return status from a command and the second is the trap command within your shell .

    第一个是命令的返回状态,第二个是外壳中的 trap 命令