[sf-lug] ps and grep

jim stockford jim at well.com
Thu Mar 6 18:10:28 PST 2008

    in general, the shell is designed to read a command
line from the right to the left.
    in the case of ps | grep, you're asking grep to read
the output of the ps command. if you run the ps command
before grep is loaded, ps will have shot its wad prematurely,
then grep will load and feel like it was stood up. so grep
has to be loaded first so's to be waiting there to catch
whatever ps shoots.

On Mar 6, 2008, at 5:57 PM, Christian Einfeldt wrote:

> On Thu, Mar 6, 2008 at 5:48 PM, Tom Haddon <tom at greenleaftech.net> 
> wrote:
>>  On Thu, 2008-03-06 at 17:47 -0800, jim stockford wrote:
>>  >
>>  > at the point you type the  ps  command and hit
>>  > enter, you've kicked off a new process, something
>>  > like
>>  > $ ps aux | grep doit
>>  >
>> Do you mean that for grep to process ps's output, grep has to be 
>> loaded
>>  first? If so, this all makes sense, and I think I have it.
> I thought that grep always came second, because there has to be 
> something to grep.

More information about the sf-lug mailing list