#!/usr/bin/env bash function top_level_parent_pid { # Look up the parent of the given PID. pid=${1:-$$} stat=($(