I try to write a function in .bash_profile to define a function for process killing as follows:
function pkill {
pid = ps -elf|grep python|grep $1|awk -F " " '{print $4}'
kill -9 pid
}
And what I want to do is using "pkill keyword" to kill the process that pid=[ps -elf|grep python|grep keyword|awk -F " " '{print $4}'],and my code didn't work.How should I write this function?
about kill:
my python process is multithreaded.I've tried kill pid,kill -TERM pid,orkill -INT pid,but still can find it in the processlist.So I used 'kill -9'.
pkill(linux.die.net/man/1/pkill) available on your system? – akira Mar 10 '10 at 12:55kill -9: aplawrence.com/SCOFAQ/FAQ_scotec6killminus9.html and sial.org/howto/shell/kill-9 and speculation.org/garrick/kill-9.html – Dennis Williamson Mar 10 '10 at 14:10