shell得到脚本的爷爷的进程名
更新:HHH   时间:2023-1-7


#!/bin/sh

echo "father pid $PPID"
grandpaPid=`ps -f $PPID | awk '{if (NR==2) print $3}'`

echo "grandpa pid $grandpaPid"
grandpaName=`head -n 1 /proc/$grandpaPid/status | awk '{print $2}'` 
echo "my grandPa Name : <$grandpaName>"
返回开发技术教程...