title: ksh script to execute a piped command and looping over the results
body: <p>I need to run a long piped command in ksh like this</p>
  
  <pre><code>cmd='ps -e -o args | /usr/bin/grep abcde | /usr/bin/grep -v grep'
  </code></pre>
  
  <p>Then execute this command.
  And then loop over the results. 
  So I am trying the above line and then</p>
  
  <pre><code>$cmd | while read $arg1 $arg2 ; do
      echo $arg1 $arg2
      blah  $arg1 $arg2
  done
  </code></pre>
  
  <p>And there can be more than two args as well in the result.
  I am not able to execute this and get the result what I want.
  Can somebody please suggest what is wrong in this and how i need to correct it. </p>