[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Binand's program



On Wed, Aug 11, 1999 at 01:26:21AM +0500, RAJESH J. ADVANI wrote:
> I just ran Binand's program that keeps changing it's pid and name
> Well it's easy to stop it. Just ctrl-d will do
> But I'm trying to write a command that will do it.
> I'm a newbie to UNIX. Won't sleep till I get this...
> I've gotten as far as 

ctrl-D will log you out! Kinda like using a sledgehammer to crack a nut,
don't you think?

> 
> ps a | grep /tmp/file | head -c 5 ; echo

An easier way is:

ps x | grep file | awk ' { print $1 } '

to get the PID.

To pass it to kill, you should do something like:

kill -TERM `ps x | grep file | awk ' { print $1 } '`

But by the time you type this out, it will change its PID :-)

> which basically gives me the pid.
> 
> How do I give this as an argument to kill?
> This is fun!

As a hint, investigate the skill command.

Binand
- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
The Linux India mailing list does not accept postings in HTML format.

------------------------------