Instantly share code, notes, and snippets.
This now works for Linux and macOS.
Hello Richard, I have came up with an endless loop when one of my top parent processes had parent pid set to itself instead of to 1.
To handle I changed:
[[ $pid -gt 1 ]]
[[ $pid -gt 1 && $pid -ne $ppid ]]