Find the answer to your Linux question:
Results 1 to 3 of 3
Hi guys my apologies if something like this has been asked already. Im trying to create a menu driven system in the vi editor to perform some administration tasks and ...
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Location
    Bolton, UK
    Posts
    2

    Implementing a process kill utility in the vi editor

    Hi guys my apologies if something like this has been asked already.

    Im trying to create a menu driven system in the vi editor to perform some administration tasks and i would like to be able to kill a process of my choice and im a bit clueless with the code i need to implement for it to work. I have so far been able to create this but im not sure where i am going wrong:

    echo "enter process id"
    read pid
    ps -eaf | grep $pid | grep -v grep | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9}'
    echo "do you want to proceed?"
    if [ "$reply" = "y" ]; then
    kill
    else
    echo
    fi
    echo "hit the enter key to continue"
    read junk;;

    If there is anyone out there that would be able to help me in anyway then that would be greatly appreciated

  2. #2
    Linux Newbie raghaven.kumar's Avatar
    Join Date
    Mar 2008
    Location
    Bangalore, India
    Posts
    209

    Lightbulb

    Quote Originally Posted by karlywarly View Post
    echo "enter process id"
    read pid
    ps -eaf | grep $pid | grep -v grep | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9}'
    echo "do you want to proceed?"
    if [ "$reply" = "y" ]; then
    kill
    else
    echo
    fi
    echo "hit the enter key to continue"
    read junk;;
    isnt that supposed to be
    kill $pid

  3. #3
    Just Joined!
    Join Date
    Apr 2008
    Location
    Bolton, UK
    Posts
    2
    Hi
    thanks for the reply yes i wasnt sure about that as im quite new to this but there is something else wrong with the code that im not sure about as it doesnt work i have got all confused with what im trying to do

Posting Permissions

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