[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kill script



Hi David!

On Wed, 23 Feb 2000, David Wiard wrote:

> how about a csh/ksh version?  this is for work on HPUX, but we
> don't have bash.

Sorry, I don't know those shells but if they don't have functions, you
can still make a script like this one:

#!/bin/tcsh

kill -9 `ps -e | grep $1 | grep -v grep | awk ' { print $1 } ' `


This one's tested (as the hash-bang shows :) with tcsh. It should work
with csh too I assume.

It might be a good idea to put a little syntax check into it:


#!/bin/tcsh

if ( "$1" != "" )  then
  kill -9 `ps -e | grep $1 | grep -v grep | awk ' { print $1 } ' `
else
  echo "Syntax: $0 name"
endif

Hope that helps.



-- 
Weasel                            http://www.cosy.sbg.ac.at/~ppalfrad/
PGP/GPG encrypted messages prefered. See my site or finger -l ppalfrad
----------------------------------------------------------------------
          Yes means No and No means Yes. Delete all files [Y]?

Attachment: pgp5loSDBWF5Q.pgp
Description: PGP signature


Reply to: