1

This might be a vague title, but it's hard to explain what I'm doing in a short title.

I have a tool that removes adware and it mainly runs in bash. Some of the programs I want to kill may have multiple PIDs or output files. Here's what I have and what I want to do:

lsof +D /Applications/appIDontWant.app/ | cut -d " " -f 2 1>

So I have this which gets the PIDs for the application and I can then output using 1> to a text or something, but what if I want to output the PIDs to a

sudo kill 

? Would this be another time to use | ? (I'm vaguely familiar with pipe, but not great.)

Now, I do know that I can simply put

sudo kill appIDontWant.app 

but that's just not any fun.

4

Assuming your command results in a number of PIDs

sudo kill $(lsof +D /Applications/appIDontWant.app/ | cut -d " " -f 2)

should do the trick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .