免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1584 | 回复: 1
打印 上一主题 下一主题

[文本处理] 如何脚本表示什么意思? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-05-02 22:26 |只看该作者 |倒序浏览
  1. #!/usr/bin/sh
  2. trap "exit" 2 3
  3. trap "exit" 1
复制代码

论坛徽章:
16
IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每月发帖之星
日期:2015-09-11 19:30:52IT运维版块每周发帖之星
日期:2015-09-11 19:20:31IT运维版块每日发帖之星
日期:2015-08-26 06:20:00每日论坛发贴之星
日期:2015-08-20 06:20:00IT运维版块每日发帖之星
日期:2015-08-20 06:20:002015年辞旧岁徽章
日期:2015-03-03 16:54:15金牛座
日期:2014-05-04 16:58:09双子座
日期:2013-12-17 16:44:37辰龙
日期:2013-11-22 15:20:59狮子座
日期:2013-11-18 22:55:08射手座
日期:2013-11-12 10:54:26
2 [报告]
发表于 2013-05-02 23:36 |只看该作者
本帖最后由 wenhq 于 2013-05-02 23:38 编辑

trap [-lp] [[arg] sigspec ...]
              The command arg is to be read and executed when the shell receives signal(s) sigspec.  If arg is absent (and there is a single sigspec) or -,  each specified  signal  is reset to its original disposition (the value it had upon entrance to the shell).  If arg is the null string the signal speci-fied by each sigspec is ignored by the shell and by the commands it invokes.  If arg is not present and -p has been supplied, then  the  trap  commands associated with each sigspec are displayed.  If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal.  The -l option causes the shell to print a list of signal names and their corresponding numbers.  Each sigspec is either a signal name defined in <signal.h>, or a signal number.  Signal names are case insensitive and the SIG prefix is optional.

              If  a sigspec is EXIT (0) the command arg is executed on exit from the shell.  If a sigspec is DEBUG, the command arg is executed before every simple command, for command, case command, select command, every arithmetic for command, and before the first command executes  in  a  shell  function (see SHELL GRAMMAR above).  Refer to the description of the extdebug option to the shopt builtin for details of its effect on the DEBUG trap.  If a sigspec is RETURN, the command arg is executed each time a shell function or a script executed with the . or source builtins finishes executing.

              If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status, subject to the  following  conditions.   The ERR  trap  is not executed if the failed command is part of the command list immediately following a while or until keyword, part of the test in an
              if statement, part of a command executed in a && or ?.. list, or if the command?. return value is being inverted via !.  These are the  same  conditions obeyed by the errexit option.

              Signals  ignored upon entry to the shell cannot be trapped or reset.  Trapped signals that are not being ignored are reset to their original values in a subshell or subshell environment when one is created.  The return status is false if any sigspec is invalid; otherwise trap returns true.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP