Cannot kill pid - No such process
conandrum opened this issue · comments
conandrum commented
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?