How can I run command in bash to kill all python scripts except script called test.py and the grep's pid itself, in case we are using something like ps -ef |grep
I think I can use something like pgrep python to ignore the grep process, but how do I also exclude the test.py script?  I know there is an option to do grep -v, is there option to do pgrep -v
Clarification: except grep process- means when we do for example ps -ef |grep test1.pywe get also the grep pid that used to bring this result.
I don't want to kill it as this process is no longer exist in the stage that results are shown. 


pgrepandpkillare perhaps better solutions than the usualps ... | grep -v greporps ... | grep '[s]omething'tricks.test.pyscripts are running in parallel, possibly with varying command lines (e.g.,test.py -a,test.py -b, etc.)?