Bash: how to check if a process id (PID) exists

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-06-15T09:30:26Z Indexed on 2010/06/15 9:42 UTC
Read the original article Hit count: 209

Filed under:
|

Hi All,

In a bash script i want to do the following (in pseudo-code):

if [ a process exists with $PID ]; then

    kill $PID 

fi

What's the appropriate bash for the conditional statement?

Thanks

© Stack Overflow or respective owner

Related posts about bash

Related posts about pid