title: Get child process id
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/392022/best-way-to-kill-all-child-processes">Best way to kill all child processes</a>  </p>
  </blockquote>
  
  
  
  <p>I am running a script, which runs a java program in the background using the eval command.</p>
  
  <pre><code>eval &lt;java java_program &amp; &gt;
  </code></pre>
  
  <p>While running the above command, I found that it creates a new child process. Now when I want to stop the process, in the script I tried with the command '$!', which always gives me only parent process id. So <code>kill -9 $!</code> kills the parent process and leaves the child process still running in background.</p>
  
  <p>Is there a way to find all the child processes associated with a process id and kill all the processes? Or what's the efficient way of killing all the process?</p>