neurobin / shc

Shell script compiler

Home Page:https://neurobin.org/projects/softwares/unix/shc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot kill pid - No such process

conandrum opened this issue · comments

I am trying to kill a process. Before killing it I check if it exists.

[ -n "${cmdpid}" -a -d "/proc/${cmdpid}" ] && echo "process ${cmdpid} exists" || echo "process ${cmdpid} not exists"
kill "${cmdpid}"; trap "kill $cmdpid" SIGTERM

When the kill command runs though, I get
process 26512 exists
environment: line 289: kill: (26512) - No such process

How can I fix this?