Last active
February 12, 2024 19:19
-
-
Save dumbmoron/1b174d27c086ac976b4f0f4cc5d5d0c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# rpgrep - recursive pgrep(1) | |
[ $# = 0 ] \ | |
&& echo "usage: $0 <pid>" \ | |
&& exit 1 | |
get_children() { | |
pgrep -P "$1" | \ | |
while read pid; do | |
echo "$pid"; | |
get_children "$pid"; | |
done | |
} | |
echo $1 | |
get_children "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment