Pgrep returns mutiple PIDs

view story

http://unix.stackexchange.com – My script accepts a process name as an input and kills it, I tried using pgrep but its returning two PIDs , one for the process which is running and one for the script which accepts the process name as input so am stuck! I tried using the pgrep -fo option too but that did not help either. Any suggestions would be helpful this is my script #!/bin/bash ProcessName=$1 pID= pgrep -fl $ProcessName echo $pID so when i invoke the script its returning two PIDs bash-3.00$ ./dynamic_values.sh test-Process 10534 /xxx/xxo/xxx/xxe --run --propFile /application/test/test-Process_Archive.tra --innerPr (HowTos)