title: How to get PID from forked child process in shell script
body: <p>I believe I can fork 10 child processes from a parent process.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>#/bin/sh
  fpfunction(){
      n=1
      while (($n&lt;20))
      do
          echo "Hello World-- $n times"
          sleep 2
          echo "Hello World2-- $n times"
          n=$(( n+1 ))
      done
  }
  
  fork(){
      count=0
      while (($count&lt;=10))
      do
          fpfunction &amp;
          count=$(( count+1 ))
      done
  }
  
  fork
  </code></pre>
  
  <p>However, how can I get the pid from each child process I just created?</p>