我试图按名称杀死进程。它应该首先杀死孩子的过程,然后是父母,但我只是让父母被杀。需要帮助。编辑:已解决
答案 0 :(得分:0)
请这样试试:
PID=$(ps -aef | grep `whoami` | grep $argument | grep -v grep | grep -v $$ | awk '{print $2}'
for x in ${PID[@]}; do
CPID=$(ps -aef | grep `whoami` | grep $PID | grep -v grep | grep -v $$ | awk '{print $3}'
for y in ${CPID[@]}; do
kill $y
done
kill $x
done