How to check if a process id (PID) exists

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 expression for the conditional statement?

11 Answers
11

Leave a Comment