在shell提示符号下输入type killproc,会发现killproc实在 /sbin/目录下,通过man killproc可以查看这个脚本(姑且这么称为脚本)的用法,现在,把这个脚本的实现过程通过脚本实现了,请看下面脚本。

#!/bin/bash
#
# This script kills all programs specified in the input line
#
# Example:   killproc hello
#   This will kill all processes whose name contains hello
#
ps -e | grep $1 | {
   while read pid tty time cmd;
   do
      echo "Killing $pid ==> $cmd"
      kill -9 $pid
   done
}
exit

相关文章:

  • 2022-12-23
  • 2021-11-14
  • 2021-08-15
  • 2021-11-04
  • 2022-12-23
  • 2023-01-15
  • 2021-08-25
  • 2021-08-18
猜你喜欢
  • 2021-12-17
  • 2021-10-23
  • 2021-10-26
  • 2022-03-06
  • 2021-06-04
相关资源
相似解决方案