免费注册 查看新帖 |

Chinaunix

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

难道是kill 的bug ? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-24 10:48 |只看该作者 |倒序浏览
KILL(1)                                               User Commands                                               KILL(1)

NAME
       kill - send signals to processes, or list signals
SYNOPSIS
       kill [-s SIGNAL | -SIGNAL] PID...
       kill -l [SIGNAL]...
       kill -t [SIGNAL]...
DESCRIPTION
       Send signals to processes, or list signals.
       Mandatory arguments to long options are mandatory for short options too.
       -s, --signal=SIGNAL, -SIGNAL
              specify the name or number of the signal to be sent
       -l, --list
              list signal names, or convert signal names to/from numbers
       -t, --table
              print a table of signal information
       --help display this help and exit
       --version
              output version information and exit

       SIGNAL  may be a signal name like `HUP', or a signal number like `1', or an exit status of a process terminated by
       a signal.  PID is an integer; if negative it identifies a process group.
       NOTE: your shell may have its own version of kill, which usually supersedes the version  described  here.   Please
       refer to your shell's documentation for details about the options it supports.
AUTHOR
       Written by Paul Eggert.
      
      
COPYRIGHT
       Copyright ? 2005 Free Software Foundation, Inc.
       This  is  free  software.   You  may  redistribute  copies of it under the terms of the GNU General Public License
       <http://www.gnu.org/licenses/gpl.html>.  There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
       The full documentation for kill is maintained as a Texinfo manual.  If the info and  kill  programs  are  properly
       installed at your site, the command
              info kill
       should give you access to the complete manual.

但是kill却不支持这两个参数
      
kill --help
-bash: kill: -help: invalid signal specification
kill  --version
-bash: kill: -version: invalid signal specification

论坛徽章:
0
2 [报告]
发表于 2009-12-24 11:11 |只看该作者
关键时候本人给你指点迷津, 请看:

-bash-3.2$ type kill
kill is a shell builtin
-bash-3.2$ `which kill` --help
usage: kill [ -s signal | -p ] [ -a ] pid ...
       kill -l [ signal ]

明白了否?

论坛徽章:
0
3 [报告]
发表于 2009-12-24 11:29 |只看该作者
嗯,有点明白了,多谢指点

那么一般如果需要使用kill的时候,是使用builtin 的kill还是指定路径使用/bin/kill 这个kill呢?

两者有什么区别?

论坛徽章:
0
4 [报告]
发表于 2009-12-24 11:51 |只看该作者
Great question!! The major difference  b/w the two is that shell built-in version of kill  accept job id as its argument, example:

-bash-3.2$ sleep 100 &
[1] 25623
-bash-3.2$ `which kill` %1
kill: can't find process "%1"
-bash-3.2$ kill %1
-bash-3.2$
[1]+  Terminated              sleep 100


Does that make sense ?

论坛徽章:
0
5 [报告]
发表于 2009-12-24 14:04 |只看该作者

回复 #4 nhw_cs 的帖子

明白了,多谢  

论坛徽章:
0
6 [报告]
发表于 2009-12-24 15:19 |只看该作者

回复 #3 滑翔的蜗牛 的帖子

builtin 的kill还是指定路径使用/bin/kill?

builtin 和 /bin, 不太理解有什么区别,高手给解释一下,谢

论坛徽章:
0
7 [报告]
发表于 2009-12-24 22:44 |只看该作者

回复 #4 nhw_cs 的帖子

学习学习

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
8 [报告]
发表于 2009-12-24 22:55 |只看该作者

回复 #6 yazi0127 的帖子

4楼既有文字描述,又有实例讲解,还是不理解?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP