Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    2

    Unanswered: ksh: -exec: not found

    when running this query in soalris :

    ps -ef | grep xyz | grep -v grep | awk '{print $2 }' | -exec kill -9 {} \;

    My objective is to kill all processes that have xyz in common.

    Help please.... Thanks

  2. #2
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Untested...

    You'd best make sure that 'xyz' is a pretty unique string. I'll let you judge how safe this is!

    kill -9 $(ps -ef | awk '/xyz/ && $3 != thisPPID {print $2}' thisPPID=$$)

  3. #3
    Join Date
    Mar 2003
    Location
    shanghai,china
    Posts
    3
    maybe you can use grep "precise match function" to realize it.
    kill -9 `ps -ef |grep "\<xyz\>" |awk '{print $2}'`

    just only match the word "xyz", not xxyz,xyz1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •