Skip to main content
edited tags
Link
doneal24
  • 5.9k
  • 2
  • 21
  • 42
deleted 21 characters in body; edited tags
Source Link
dr_
  • 32.4k
  • 22
  • 102
  • 147

In the below shell script I have list of process ID'sIDs which need to be killed. When killing a process I am getting kill: 1234567: no such process error even after checking if the process id existence using ps -p. Can somebody explain whatWhat could be the reason?

for pid in ${pids[@]}; do
     if ps -p $pid > /dev/null; then
         kill -9 $pid
     fi     
done

In the below shell script I have list of process ID's which need to be killed. When killing a process I am getting kill: 1234567: no such process error even after checking if the process id existence using ps -p. Can somebody explain what could be the reason

for pid in ${pids[@]}; do
     if ps -p $pid > /dev/null; then
         kill -9 $pid
     fi     
done

In the below shell script I have list of process IDs which need to be killed. When killing a process I am getting kill: 1234567: no such process error even after checking if the process id existence using ps -p. What could be the reason?

for pid in ${pids[@]}; do
     if ps -p $pid > /dev/null; then
         kill -9 $pid
     fi     
done
edited tags
Link
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k
Source Link
Harry
  • 239
  • 5
Loading