ww111697
asked on
kill certain process
we can use the following to kill process by name
$cat kill1
kill `ps|grep $1|awk '{print $1}'`
then we can call it by kill1 sleep
But there is a problem, it will kill all process named sleep. How can I change it so that it only kills a certain process, such as the third one or the first one?
$cat kill1
kill `ps|grep $1|awk '{print $1}'`
then we can call it by kill1 sleep
But there is a problem, it will kill all process named sleep. How can I change it so that it only kills a certain process, such as the third one or the first one?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
very good answer
# keep in mind that you might get more than one process