|
get_ppid() { # get ppid of pid $1 |
get_ppid 2 returns a large number. I guess it sums the ppids of all pids containing 2
Possible replacement:
get_ppid() {
local pid_to_check="${1:empty_pid}"
local res=''
res="$( $Myps ax -o pid,ppid \
| grep -E '^\s+'"${pid_to_check}"'\s+' \
| awk ' { print $2 } '
)"
if [ -z "$res" ] ; then
echo "" # what should be printed here?
return 1
else
echo "$res"
return 0
fi
}
x11docker/x11docker
Line 917 in 8357d94
get_ppid 2returns a large number. I guess it sums the ppids of all pids containing 2Possible replacement: