12 lines
192 B
Bash
Raw Normal View History

2025-01-12 00:52:51 +08:00
# 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