Killing linux process by piping the id

前端 未结 4 1803
一个人的身影
一个人的身影 2021-01-27 13:31

I want to kill a process and I get its id with:

pgrep -f \"python myscript.py\"

I would like to call

kill -s SIGINT 

4条回答
  •  情歌与酒
    2021-01-27 14:04

    Try the backtick operator for evaluating a sub-command

    kill -s SIGINT `pgrep -f "python myscript.py"`
    

    (untested)

提交回复
热议问题