2025-01-12 04:36:52 +08:00

12 lines
192 B
Bash

# given a PID, output all its child PIDs recursively
list_children() {
for j in $(pgrep -P $1); do
echo $j
echo $(list_children $j)
done
}
for i in $@; do
list_children $i
done