I use it when I want to execute a command in the shell, divide the result, and store it in a variable.
$ set $(echo "1 2 3" | awk -F" " '{print $1, $2, $3}' )
$ echo $1
1
$ echo $2
2
$ echo $3
3
Combined with the ps command, the zombie process with PPID = 1 I'm using it to get rid of it.
cmd="Zombie process name" #Zombie process created by bugs
ppid=1 # PPID=1
ps all | while read F UID PID
do
set $(ps o pid,ppid,cmd -p $PID | tail -n1 | awk -F" " '{print $1, $2, $3}'
if [ $ppid = $2 ] && [ $cmd = $3 ] ; then
sudo kill -9 $PID
fi
done
Recommended Posts