I
I
ince2020-09-16 14:32:23
bash
ince, 2020-09-16 14:32:23

How to get the program's response into a variable?

I do such an operation - I delete the program that hangs on the 80th port.
But first I look at her ID.
Question - is it possible to organize a bash script from this?
How to write the application ID to a variable and then read it?

[email protected]:~# sudo netstat -lpn |grep :'80'
tcp      0     0 0.0.0.0:80     0.0.0.0:*     LISTEN      30290/program: cp 
[email protected]:~# kill -9 30290

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Roo, 2020-09-16
@ince

sudo kill -9 $(sudo lsof -t -i:80)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question