Question: ----LINUX BASH SCRIPTING--- Hello, I have a list of ppid, I want to list them as PID and COMM for each value, I did it
----LINUX BASH SCRIPTING---
Hello,
I have a list of ppid, I want to list them as PID and COMM for each value, I did it this way which works fine except when $a= 0(root) because ps -p doesn't work for pid 0 anyway, is there another way where I can do the same without getting error for pid 0?

echo -e "PID] tCoMM" for a in Slist do #print the pid and command of each parent process ps -p Sa ho pid, comm #echo $a done echo -e "PID] tCoMM" for a in Slist do #print the pid and command of each parent process ps -p Sa ho pid, comm #echo $a done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
