8 descpids - List all descendant process PIDs of the given process(es)
15 declare -A all_descendants
=()
16 declare -A all_ancestors
=()
20 all_ancestors
[$ancestor]=''
23 while [ "${#all_ancestors[@]}" -gt 0 ]
25 for ancestor
in "${!all_ancestors[@]}"
27 for descendant
in `pgrep -P "$ancestor"`
29 all_descendants
[$descendant]=''
30 all_ancestors
[$descendant]=''
32 unset all_ancestors
[$ancestor]
36 echo "${!all_descendants[@]}"