Linux -trap
来源:互联网 发布:ubuntu 更新内核 编辑:程序博客网 时间:2024/06/01 07:31
Trap
The trap command allows you to execute a command when a signal is received by your script. It works like this:
trap arg signals
note: signals is a list of signals to intercept and "arg" is a command to execute when one of the signals is received.
trap 命令,用来相应信号。其命令格式如下:
trap "command or commands" signal-numbers(or names)
note:命令或者命令组应该放在双引号内,多个命令用分号隔开,多个信号之间用空格分开
trap的三种形式
(1) 如果trap中命令丢失,表示脚本接受信号的默认动作
(2)如果捕获信号的命令参数是空字符串,表示脚本需要忽略这些信号。例如 trap "" 2 3 表示信号2,3将被忽略
(3)如果捕获信号的命令参数包含一个或者一组命令,表示脚本需要捕获信号,并在信号采取自己的动作之前保存一段时间一遍完成某些动作。
如:
trap "cp ~/file1 /root/" 2 3 15
待续。。。
0 0
- linux trap
- trap linux
- Linux -trap
- linux trap命令
- linux trap 詳解
- linux trap命令
- linux 中的trap命令
- linux脚本----trap
- Linux 信号捕捉trap
- linux trap命令
- linux trap command signal
- linux trap 詳解
- LINUX trap命令
- linux shell trap
- linux trap命令详解
- Linux trap用法介绍
- Linux trap命令
- Linux Trap命令
- 函数以及面向对象的思想
- UVA 10870 Recurrences
- MYSQ学习
- 代码大全_第七部分: 软件工艺
- HTML5本地存储之Database Storage篇[2]
- Linux -trap
- 实现一个函数判断year是不是闰年。
- android studio2.1解决Unable to detect adb version, adb output
- QQ空间直播秒开优化实践
- TCP负载均衡方案
- SSDP,简单服务发现技术
- 大话设计模式20----迭代器模式
- HTTP请求——ETag
- ListView常用拓展(Android群英传)