According to Michael Trausch: While burning my CPU.
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hmmm, I hadn't realized that the pipes in UNIX worked like that... But,
> that explains why when I do this:
> 
>       $ ps ax | grep pine
> 
> I get this:
> 
>  1525   1 S    0:05 pine
>  1574   2 S    0:00 grep pine
> 
> as output.  :-)  How interesting.

Even more intersting is;

ps ax | grep pine | grep -v grep | grep -v ps | awk '{ print $1 }'

Which will return the PID (process number) of pine. So say for instance you
want to kill processes automaticly, you could just do, (in a script)

PID=`ps ax | grep pine | grep -v grep | grep -v ps | awk '{ print $1 }'`
kill $PID

Or check that a process is running if so kill it.


RUNNING=`ps ax ./net | wc -l`
PID=`ps ax ./net | awk '{ print $1}'`

if [ $RUNNING -gt 0 ]; then
 kill -9 $1
fi

If you cant see what that is let me know, i wil explain.

> 
>       - Mike
> 
> =====================================================================
> Michael B. Trausch                                 [EMAIL PROTECTED]
> V: (419) 838-8104                                   F: (815) 846-9374
> 
>    "Curiosity is the very basis of education and if you tell me that
>    curiosity killed the cat, I say only the cat died nobly."
>                                                 - Arnold Edinborough
> 
> If you do not have my public PGP key, you are encouraged to obtain it
> from my website at http://www.wcnet.org/~mtrausch/mt_pgp_key.gz.  You
>             need to have PGP 5.0i or newer to use the key.
> =====================================================================
> 
> On Sat, 20 Feb 1999, Raider wrote:
> 
> > On Sat, 20 Feb 1999, Michael Trausch wrote:
> > > I'll tell ya, as far as the CL is concerned, I used the DOS CL for a long
> > > time (about seven years) as my primary computer access.  And even then, I
> > > didn't know all there was... example: pipes.  In DOS, there was really
> > > only one use for a pipe:
> > >   A>TYPE FILENAME.EXT | MORE <ENTER>
> > > You couldn't even do something like this:
> > >   A>TYPE FILENAME.EXT | PRINT <ENTER>
> >  
> >     That's because a dos pipe isn't a 'real' pipe.  Part of it's
> > limitation is imposed by the fact that dos isn't multitasking.  So a real
> > pipe would launch the first command, than the second and so on without
> > waiting for the previous command to end.  Than it will connect the output
> > of the first with the imput of the second and so on.  And this will be
> > done in real time.  The sad part for m$ users is although dos7 is somehow
> > multitasking when run in a window this feature wasn't corrected.
> > 
> >     Raider
> > --
> >             ``Liberate tu-temet ex inferis''
> > 
> > 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 5.0i for non-commercial use
> Charset: noconv
> 
> iQA/AwUBNs7pvRLC9wZKsFmxEQJSbQCgvFJvTkkUCNWal9bn3v2Ahzd8WQgAn1/Y
> 1OAkcjhkwmRFfLSu6k3p3zt4
> =1+JD
> -----END PGP SIGNATURE-----
> 


-- 
Regards Richard.
[EMAIL PROTECTED]

Reply via email to