bash - How to check if a process id (PID) exists -
In a Bash script, I want to do the following (in the phonetic code):
  If [a process exists with $ PID]; So what is the proper expression for conditional statement to $ PID FI   ?
To check the existence of a process,
  kill -0 $ PID   but as @onwind said, still going to kill it, just kill
  $ PID   Or you'll have a running position.
 If you want to kill the  kill  text output and do something based on the exit code, you 
  if doing so Can! $ PID & gt; Killing / Dev / null 2 & gt; and 1; Then "SIGTERM could not be sent to process PID" & gt; & Amp; 2f   
Comments
Post a Comment