title: executing shell command with | (pipe) using NSTask
body: <p>I'm trying to execute this comamnd <code>ps -ef | grep test</code> using NSTask but I can't get the | grep test to be included in the NSTask:</p>
  
  <p>This is what I'm using currently to get the output of ps -ef into a string then I need to somehow get the pid of the process test</p>
  
  <pre><code>NSTask *task;
  task = [[NSTask alloc] init];
  [task setLaunchPath: @"/bin/ps"];
  
  NSArray *arguments;
  arguments = [NSArray arrayWithObjects: @"-ef", nil];
  [task setArguments: arguments];    
  NSPipe *pipe;
  pipe = [NSPipe pipe];
  [task setStandardOutput: pipe];
  
  NSFileHandle *file;
  file = [pipe fileHandleForReading];
  
  [task launch];
  
  NSData *data;
  data = [file readDataToEndOfFile];
  
  NSString *string;
  string = [[NSString alloc] initWithData: data
                                 encoding: NSUTF8StringEncoding];
  NSLog (@"got\n%@", string);
  </code></pre>