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
-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 --innerProcess 23401 /bin/bash ./dynamic_values.sh test-Process
I was expecting just 10534 but it picked up the script too . Version of OS just incase
bash-3.00$ uname -a Linux xxxxxx 2.6.9-67.0.1.