LoginSignup
2
2

More than 5 years have passed since last update.

bash で子孫プロセス共々kill する

Posted at
#!/bin/bash

function killChildren(){
    local ppid

    for ppid in $@;
    do
        killChildren $(ps --ppid $ppid -o pid --no-heading)
        set -x
        kill $ppid
        set +x
    done
}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2