Answer the question
In order to leave comments, you need to log in
Help with bash script
Friends, we need your help.
I urgently needed a solution, and only a phone was available from improvised means :-(
In general, closer to the point. It is necessary to write a script that terminates all processes in the system whose pid is less than the pid of the script itself, except for pid from 0 to 100.
P.S. Session
Answer the question
In order to leave comments, you need to log in
something like this:
$ cat kill.sh
#!/bin/bash
CUR_PID=$$
echo "CURRENT PID = " ${CUR_PID}
ps -eo pid | sed 1d | while read PID ; do [ $CUR_PID -gt $PID -a $PID -gt 100 ] && kill -15 $PID ; done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question