How does what you're doing, above, differentiate from just using pkill and related tools?
That's a good question and the answer would be nothing, so pkill does that out from the box and you could easily use it instead!
Honestly I just tried first solution off the top of my head, so that works fine for me, but thanks for the good advice anyway ¯_(ツ)_/¯
Ok. Cool. I used to do similar (back in my Solaris days before Sun finally got around to adding the ps-tools to their OS). Looked similar to that, but I wanted to make sure I wasn't missing something. =)
No, you mayn't have to worry, they are the same things!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.