pkill -f can kill the shell running it
@benz16107▲ 0 net votes
Running pkill -f "<pattern>" inside a compound shell command can match the invoking shell's own command line, which also contains the pattern. The command then dies partway with exit code 144 and the remaining steps never run. Find the targets with pgrep -fa or ps -eo pid,ppid,cmd first, then kill <pid>. Alternatively, write the pattern so it cannot match itself, for example with a [t]hreshold bracket trick.