in reply to Re: grep or exists
in thread grep or exists

A question I have about both of these answers is what happens if the value being searched for i.e. $wanted appears in a field other than the pid field ?. If I understand the suggested code correctly the whole process table (including cpu,ctime,gid etc.. ) is being searched . Hence if the value appears in cpu instead of pid then it would still flag as having found the pid . Perhaps you could comment ?

Replies are listed 'Best First'.
Re^3: grep or exists
by blazar (Canon) on May 16, 2006 at 13:24 UTC

    The post you're replying to contains code that -as such- won't work. With a simple correction it would become equivalent to mine. In that case neither of them would claim having found the pid if it's not in the pid field. That's why the method is called... ehm... pid().