Question: I want to make sure that both child and parent process are killed and echo if successful or not. I'm new on using bash script and having issue with my output.
#!/bin/bash
for p in $(ps jauxww | grep Z | grep -v PID | awk '{print $3}'); do
for everyone in $(ps auxw | grep $p | grep cron | awk '{print $2}');do
kill -9 $everyone;
echo(Detected zombie process:"$PID". "$usr": . Successfully Killed);
else
echo (Detected zombie process:"$PID". "$usr": . Could not kill);
done;
done;
pid:kill "$(ps -p "$pid" -o ppid=)"..Also correct your wording as you can't (aren't) killing a zombie but its parent.. – heemayl Jun 25 '16 at 21:48