I want to write a shell script to find the executable process for a given user and kill the process by getting the corresponding process id.
Its like
ps -ef | grep dinesh
After that, I get output like the following
dinesh 19985 19890 0 11:35 pts/552 00:00:00 grep dinesh
Here 19985 is the process identifier. I want to kill this process.
How can I achieve this using a script?
I need to parse ps command output and get process id
Thanks in advance.
source
share