title: Find the PID(s) of running processes and store as an array
body: <p>I'm trying to write a bash script to find the PID of a running process then issue a kill command. I have it partially working, but the issue I face is that there may be more than one process running. I want to issue a kill command to each PID found.</p>
  
  <p>I presume I need to put each PID in to an array but am at a loss as to how to do that.</p>
  
  <p>What I have so far:</p>
  
  <pre><code>pid=$(ps -fe | grep '[p]rocess' | awk '{print $2}')
  if [[ -n $pid ]]; then
      echo $pid
      #kill $pid
  else
  echo "Does not exist"
  fi
  </code></pre>
  
  <p>What this will do is return all PIDs on a single line, but I can't figure out how to split this in to an array.</p>