Hi, assuming that I know the PID of a process and want to do a search in ps -A, how do I do it? I tried doing this:
echo "Enter PID to search: "
read PID
search=$(ps -A | grep -v PID | awk '{print $1}')
This returns me with a long list of PIDs. So how can I get use each individual value of the output and do:
if [ "$PID" = "*each_value_in_search_list*" ]; then
........
In this case i'm trying to compare what the user enters with the output of my command, so how do I do it? Am I doing the correct way in the first place? Or is there any other way to do this?
Thanks for your help, everyone who answered this question. (: